Help please with /setadmin -
MBX97 - 20.06.2011
hey guyz i've been tried hardly and trying to fix but i can't
this is the code
pawn Код:
if(strcmp("/setadmin", cmdtext, true, 10) == 0)
{
new level,playerid2,file[256],PlayerName[MAX_PLAYER_NAME],PlayerName2[MAX_PLAYER_NAME];
new tmp2[256], Index,str[50],str2[50];
tmp = strtok(cmdtext,Index), tmp2 = strtok(cmdtext,Index),playerid2 = strval(tmp),level = strval(tmp2);
GetPlayerName(playerid2,PlayerName,MAX_PLAYER_NAME);
GetPlayerName(playerid,PlayerName2,sizeof(PlayerName2));
format(file,sizeof(file),"NewServer/Admins/%s.txt",PlayerName);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_YELLOW,"You need be RCON to use this command!");
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /setlevel id level");
if(level > 5 ) return SendClientMessage(playerid,COLOR_YELLOW,"Incorrect Level");
if(!IsPlayerConnected(playerid2))return SendClientMessage(playerid,COLOR_YELLOW,"Player is not connected!");
PlayerInfo[playerid][pAdminLevel] = level;
dini_IntSet(file,"Level",level);
format(str,sizeof(str),"* You have set %s's level to %d",PlayerName,level);
SendClientMessage(playerid,COLOR_BLUE,str);
format(str2,sizeof(str2),"* Admin '%s' has made you level %d",PlayerName2,level);
SendClientMessage(playerid2,COLOR_BLUE,str);
GameTextForPlayer(playerid2, "~r~Promoted", 5000, 3);
return 1;
}
and its not working when i put
then it must say:
Код:
Usage: /setlevel id level
but it don't ,
it says : "You have set MBX97's level to 0" , why i can't choose the level either the person id
?
please fix it guyz
and thanks alot for reading
Re: Help please with /setadmin -
Jordman248 - 20.06.2011
Try this.
Код:
if(strcmp("/setadmin", cmdtext, true, 10) == 0)
{
new level,playerid2,file[256],PlayerName[MAX_PLAYER_NAME],PlayerName2[MAX_PLAYER_NAME];
new tmp2[256], Index,str[50],str2[50];
tmp = strtok(cmdtext,Index), tmp2 = strtok(cmdtext,Index),playerid2 = strval(tmp),level = strval(tmp2);
GetPlayerName(playerid2,PlayerName,MAX_PLAYER_NAME);
GetPlayerName(playerid,PlayerName2,sizeof(PlayerName2));
format(file,sizeof(file),"NewServer/Admins/%s.txt",PlayerName);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_YELLOW,"You need be RCON to use this command!");
{
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /setlevel id level");
{
if(level > 5 ) return SendClientMessage(playerid,COLOR_YELLOW,"Incorrect Level");
{
if(!IsPlayerConnected(playerid2))return SendClientMessage(playerid,COLOR_YELLOW,"Player is not connected!");
{
PlayerInfo[playerid][pAdminLevel] = level;
dini_IntSet(file,"Level",level);
format(str,sizeof(str),"* You have set %s's level to %d",PlayerName,level);
SendClientMessage(playerid,COLOR_BLUE,str);
format(str2,sizeof(str2),"* Admin '%s' has made you level %d",PlayerName2,level);
SendClientMessage(playerid2,COLOR_BLUE,str);
GameTextForPlayer(playerid2, "~r~Promoted", 5000, 3);
}
}
}
}
}
Re: Help please with /setadmin -
MBX97 - 21.06.2011
thanks but what did you change in it ??
Re: Help please with /setadmin -
MBX97 - 21.06.2011
Not Working , Need help ??
Re: Help please with /setadmin -
HyperZ - 21.06.2011
I suggest you to use Sscanf2 and Zcmd.
Re: Help please with /setadmin -
Mean - 21.06.2011
pawn Код:
if( !cmdtext[ 10 ] ) return SendClientMessage( playerid, -1, "USAGE: /setlevel [ID] [Level]" );