Help dcmd /setadmin ID LEVEL - 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: Help dcmd /setadmin ID LEVEL (
/showthread.php?tid=117542)
Help dcmd /setadmin ID LEVEL -
ReVo_ - 31.12.2009
Hello All,
I need to create a command /setadmin ID LEVEL
What I did:
pawn Код:
dcmd_setadmin(playerid,params[])
{
if(PlayerInfo[playerid][admin]>=8 || IsPlayerAdmin(playerid))
{
new id,livello;
id = strval(params);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "Uso /setadmin [ID] [LIVELLO]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "Giocatore non connesso.");
livello = strval(params);
format(astring,sizeof(astring),"[ADMIN]: L'Admin %s ha settato %s livello %d.",Nome(playerid),Nome(id),livello);
SendClientMessageToAll(COLORE_MESSAGGI,astring);
PlayerInfo[id][admin]=livello;
} else { SendClientMessage(playerid, COLOR_RED, "Devi essere minimo admin livello 8 per usare questo comando!"); }
return 1;
}
The problem is that the id of the player and the level are the same ie I can not share with the ID LEVEL
Sorry for my English, I used a translator xD
Re: Help dcmd /setadmin ID LEVEL -
GATOSSSSSSS - 31.12.2009
alone did u write these??how did u do it
Re: Help dcmd /setadmin ID LEVEL -
Calon - 01.01.2010
Using sscanf (
https://sampwiki.blast.hk/wiki/Sscanf_code):
pawn Код:
dcmd_setadmin(playerid,params[])
{
new string[128], id, level;
if(sscanf(params, "ud", id, level))
{
SendClientMessage(playerid, COLOR_RED, "Uso /setadmin [ID] [LIVELLO]");
}
else
{
if(PlayerInfo[playerid][admin]>= 8 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(id))
{
Player[playerid][admin] = level;
format(astring,sizeof(astring),"[ADMIN]: L'Admin %s ha settato %s livello %d.",Nome(playerid),Nome(id),livello);
SendClientMessageToAll(COLORE_MESSAGGI,astring);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Giocatore non connesso.");
}
}
}
return 1;
}