- เครดิต
- 9375
- ความรู้
-
- เงิน $
-
- ความดี
-
|
1. หา public OnPlayerRequestClass(playerid, classid)
ใส่นี้ทับอันเก่าลงไป
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- public OnPlayerRequestClass(playerid, classid)
- {
- PlayerPlaySound(playerid, 1068, 0.0, 0.0, 0.0);
- PlayerInfo[playerid][pModel] = Peds[classid][0];
- if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
- {
- ClearChatbox(playerid, 10);
- SendClientMessage(playerid, COLOR_GREEN, " ~ Welcome to GTA Roleplay! ~");
- SendClientMessage(playerid, COLOR_RED, " Use Max 12 Letters in your Name or it wont save! ");
- SendClientMessage(playerid, COLOR_YELLOW2, " ");
- SendClientMessage(playerid, COLOR_YELLOW2, " ");
- SendClientMessage(playerid, COLOR_YELLOW2, " ");
- SendClientMessage(playerid, COLOR_YELLOW2, " ");
- SendClientMessage(playerid, COLOR_YELLOW2, " ");
- SendClientMessage(playerid, COLOR_YELLOW2, " ");
- if (gPlayerAccount[playerid] != 0)
- {
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"Welcome, %s\nThat nick is registered.\nYou can now login:",loginname);
- ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- }
- else
- {
- gPlayerAccount[playerid] = 0;
- new regstring[128];
- new regname[64];
- GetPlayerName(playerid,regname,sizeof(regname));
- format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
- ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
- }
- //PlayerPlaySound(playerid, 1187, 0.0, 0.0, 0.0);
- PlayerInfo[playerid][pModel] = Peds[classid][0];
- SetPlayerTeamFromClass(playerid,classid);
- }
- else SpawnPlayer(playerid);
- return false;
- /*if (classid == 1)
- {
- format(string, sizeof(string), "~y~> ~p~Police Chief ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 2)
- {
- format(string, sizeof(string), "~y~> ~p~FBI/ATF Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 3)
- {
- format(string, sizeof(string), "~y~> ~p~National Guard General ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 4)
- {
- format(string, sizeof(string), "~y~> ~p~Fire/Ambulance Chief ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 5)
- {
- format(string, sizeof(string), "~y~> ~p~Espana Drogas Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 6)
- {
- format(string, sizeof(string), "~y~> ~p~Luciano Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 7)
- {
- format(string, sizeof(string), "~y~> ~p~Mayor ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 8)
- {
- format(string, sizeof(string), "~y~> ~p~Hitman Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 9)
- {
- format(string, sizeof(string), "~y~> ~p~News Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 10)
- {
- format(string, sizeof(string), "~y~> ~p~Taxi Cab Company Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 11)
- {
- format(string, sizeof(string), "~y~> ~p~License Faction Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 14)
- {
- format(string, sizeof(string), "~y~> ~p~Nortenos Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 15)
- {
- format(string, sizeof(string), "~y~> ~p~Grove Street Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else if (classid == 16)
- {
- format(string, sizeof(string), "~y~> ~p~Jefferson Saints Leader ~y~< ~n~Leaders only!");
- GameTextForPlayer(playerid,string,3500,6);
- }
- else
- {
- format(string, sizeof(string), "~y~> ~g~Civilian ~y~<");
- GameTextForPlayer(playerid,string,3500,6);
- }
- SetPlayerTeamFromClass(playerid,classid);
- SetupPlayerForClassSelection(playerid);
- return 1;*/
- }
|
2.หา public SetupPlayerForClassSelection(playerid)
ใส่นี้ทับอันเก่าลงไป
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- public SetupPlayerForClassSelection(playerid)
- {
- /*switch (gTeam[playerid])
- {
- case TEAM_BLUE:
- {
- SetPlayerInterior(playerid,5);
- SetPlayerPos(playerid,323.4,305.6,999.1);
- SetPlayerFacingAngle(playerid, 90.0);
- SetPlayerCameraPos(playerid,323.4-1.5-1.0,305.6,999.1+0.7);
- SetPlayerCameraLookAt(playerid,323.4-1.0,305.6,999.1+0.7);
- }
- case TEAM_ADMIN:
- {
- SetPlayerInterior(playerid,3);
- SetPlayerPos(playerid,-2654.4,1424.2,912.4);
- SetPlayerFacingAngle(playerid, 90.0);
- SetPlayerCameraPos(playerid,-2654.4-1.5,1424.2,912.4+0.7);
- SetPlayerCameraLookAt(playerid,-2654.4,1424.2,912.4+0.7);
- }
- default:
- {
- SetPlayerInterior(playerid,3);
- SetPlayerPos(playerid,361.8270,174.0347,1008.3893);
- SetPlayerFacingAngle(playerid,90);
- SetPlayerCameraPos(playerid, 361.7270,169.0347,1008.3893);
- SetPlayerCameraLookAt(playerid,361.8270,174.0347,1008.3893);
- }
- }*/
- }
|
3.หา public SetPlayerTeamFromClass(playerid,classid)
ใส่นี้ทับอันเก่าลงไป
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- public SetPlayerTeamFromClass(playerid,classid)
- {
- /*if (classid >= 1 && classid <= 14)
- {
- gTeam[playerid] = 11; //admin
- PlayerInfo[playerid][pTeam] = 11;
- }
- else
- {
- gTeam[playerid] = 3;
- PlayerInfo[playerid][pTeam] = 3;
- }*/
- }
|
ที่ทำมาคือการำให้สคริปนั้นไม่อ่าน พวก civilian ต่างๆ คุณสามารถทำได้โดยไม่ต้อง copy ส่วนนี้ไปก็ได้
โดยใช้ /* ไว้ข้างหน้า และ จบด้วย */
4. หา public OtherTimer()
เอานี้ไป เพิ่มทับif(SafeTime == 1)อันเก่า
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- if(SafeTime == 1)
- {
- if(gPlayerAccount == 1 && gPlayerLogged == 0)
- {
- new loginname[64];
- new loginstring[128];
- GetPlayerName(i,loginname,64);
- format(loginstring,sizeof(loginstring),"Welcome, %s\nYou can now login:",loginname);
- ShowPlayerDialog(i,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- }
- }
|
4. หา public OnPlayerRegister(playerid, password[])
เลื่อนลงมาล่างสุดเอานี้ไปใส่
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"Welcome, %s\nYou can now login:",loginname);
- ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- }
- }
- return 1;
- }
|
ปล. บางคนมีข้อความเอาอันนี้ไปใส่ใต้ข้อความได้เลยครับ แต่ ลบ return ของอันเก่าออกด้วย
4.หา }//end while
ใส่
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- fclose(UserFile);//close the file after everything has been read in the while
- }
- else
- {
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"WRONG PASSWORD\nPlease enter the correct password:",loginname);
- ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- fclose(UserFile);
- gPlayerLogTries[playerid] += 1;
- if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
- return 1;
- }
|
อ่าๆ โทษทีลืมไปอีกอย่าง เพิ่มนี้ไปด้วย
คัดลอกโค้ด (สำหรับ IE เท่านั้น)- //---------------------------<[ OnDialogResponse ]>--------------------------------------------------------
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new sendername[MAX_PLAYER_NAME];
- new string[128];
- if(response)
- {
- if(dialogid == 12346 || dialogid == 12347)
- {
- if(strlen(inputtext))
- {
- new tmppass[64];
- strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
- //Encrypt(tmppass);
- OnPlayerLogin(playerid,tmppass);
- }
- else
- {
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"WRONG PASSWORD\nPlease enter the correct password:",loginname);
- ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
- gPlayerLogTries[playerid] += 1;
- if(gPlayerLogTries[playerid] == 5) { Ban(playerid); }
- }
- }
- if(dialogid == 12345)
- {
- if(strlen(inputtext))
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "%s.ini", sendername);
- new File: hFile = fopen(string, io_read);
- if (hFile)
- {
- SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
- fclose(hFile);
- return 1;
- }
- new tmppass[64];
- strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
- //Encrypt(tmppass);
- OnPlayerRegister(playerid,tmppass);
- }
- else
- {
- new regstring[128];
- new regname[64];
- GetPlayerName(playerid,regname,sizeof(regname));
- format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
- ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
- }
- }
- }
- else
- {
- Kick(playerid);
- }
- return 1;
- }]
|
เพิ่มไว้บนpublic OnPlayerCommandText(playerid, cmdtext[])
จบ
Credit : up-pickup
|
|