SA-MP Forums Archive
Compile crashes on dcmd_setlevel - 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: Compile crashes on dcmd_setlevel (/showthread.php?tid=90974)



Compile crashes on dcmd_setlevel - The_Tough - 11.08.2009

can you explain why it crashes ?

dcmd_setlevel(playerid,params[])
if(PlayerData[playerid][Level] == 3)
{
new tmp[256],idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
return SystemMsg(playerid,"Usage: /setadmin <playerid> <level 1-3>");
}
new id = strval(tmp);
if(!IsPlayerConnected(id))
{
return SystemMsg(playerid,"Incorrect player !");
}
new level = strval(tmp);
if(level > 4)
{
SendClientMessage(playerid,COLOR_GREY,"Error: Maximum level - 3");
return true;
}
new string[256], pname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
GetPlayerName(pid,pname,sizeof(pname));
GetPlayerName(playerid,adminname,sizeof(adminname) );
format(string,sizeof(string),"[ ! ]===> %s has made you an administrator level %d)",adminname,level);
SendClientMessage(id,COLOUR_RED,string);
PlayerData[id][Level] = level;
return true;
}
else return SendClientMessage(playerid,COLOR_GREY,"NOTICE: This is an admin (level 3) command only.");
}


Re: Compile crashes on dcmd_setlevel - Joe Staff - 11.08.2009

Count your brackets


Re: Compile crashes on dcmd_setlevel - The_Tough - 11.08.2009

9 xD that crashes it ?


Re: Compile crashes on dcmd_setlevel - Joe Staff - 11.08.2009

You have more closing brackets than you do opening brackets, that's what I mean.


Re: Compile crashes on dcmd_setlevel - The_Tough - 11.08.2009

I forgot that dcmd_setadmin(playerid,params[]) *{*

EDIT:I fixed the brackets thanks