Compile crashes on dcmd_setlevel
#1

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.");
}
Reply
#2

Count your brackets
Reply
#3

9 xD that crashes it ?
Reply
#4

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

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

EDIT:I fixed the brackets thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)