11.08.2009, 16:51
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.");
}
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.");
}