Question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question (
/showthread.php?tid=128080)
Question -
[LSB]TheGame - 16.02.2010
Someone point out why this crashes server when i try to use it on some one
thanks
Код:
dcmd_makeuca(playerid,params[])
{
if(PlayerData[playerid][Owner] < 1) return SendClientMessage(playerid, RED, "SERVER MESSAGE: You are not the owner");
new tmp[256],idx;
tmp = strtok(params,idx);
if(!strlen(tmp)) { SendClientMessage(playerid,WHITE,"Correct Usage: /makeuca [playerid]"); return true; }
new otherplayer = strvalEx(tmp);
if(!IsPlayerConnected(otherplayer)) { SendClientMessage(playerid,RED,"SERVER MESSAGE: Incorrect ID"); return true; }
tmp = strrest(params,idx);
new string[256], pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME];
GetPlayerName(otherplayer,pname,sizeof(pname));
GetPlayerName(playerid,pname2,sizeof(pname2));
PlayerData[otherplayer][ucadmin] = 1;
format(string,sizeof(string)," You made %s UnderCover Admin. ", pname);
SendClientMessage(playerid,COLOR_RED,string);
SendClientMessage(otherplayer,COLOR_RED,"You have been made UnderCover Admin by %s check /ucacmds",pname2);
return true;
}
Re: Question -
Nero_3D - 16.02.2010
Put between each line a print("Test"); and check how often "Test" was printend
Maybe add some numbers (it would be a bit stupid to count all "Test" lines if you use a loop)
pawn Код:
dcmd_makeuca(playerid,params[])
{
print("Test 01");
if(PlayerData[playerid][Owner] < 1) return SendClientMessage(playerid, RED, "SERVER MESSAGE: You are not the owner");
print("Test 02");
new tmp[256],idx;
print("Test 03");
tmp = strtok(params,idx);
print("Test 04");
if(!strlen(tmp)) return SendClientMessage(playerid,WHITE,"Correct Usage: /makeuca [playerid]");
print("Test 05");
new otherplayer = strvalEx(tmp);
print("Test 06");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid,RED,"SERVER MESSAGE: Incorrect ID");
print("Test 07");
tmp = strrest(params,idx);
print("Test 08");
new string[256], pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME];
print("Test 09");
GetPlayerName(otherplayer,pname,sizeof(pname));
print("Test 10");
GetPlayerName(playerid,pname2,sizeof(pname2));
print("Test 11");
PlayerData[otherplayer][ucadmin] = 1;
print("Test 12");
format(string,sizeof(string)," You made %s UnderCover Admin. ", pname);
print("Test 13");
SendClientMessage(playerid,COLOR_RED,string);
print("Test 14");
SendClientMessage(otherplayer,COLOR_RED,"You have been made UnderCover Admin by %s check /ucacmds",pname2);
print("Test 15");
return true;
}
Now just complie the code and test it, then you know which line crashed the server