06.08.2015, 12:22
How to make this command to can use only by name Sn4ke ?
what i want to say is like if (name == Sn4ke )
{
This is an example, i know is not like that :P
}
PHP код:
CMD:makeadmin(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu esti logat!");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 6)
{
new id,adminlevel,sendername[30],giveplayer[30],string[200];
if(sscanf(params, "ui",id,adminlevel)) return SCM(playerid, 0xFFFFFFFF, "Tasteaza: /makeadmin <Name/Playerid> <Admin Level>");
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
if(adminlevel == 0)
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[id][pAdmin] = 0;
printf("AdmCmd: %s removed %s admin.", sendername, giveplayer);
format(string, sizeof(string), "** Admin %s te-a scos din functia de admin!", sendername);
SCM(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "L-ai scos din functia de admin pe %s!", giveplayer);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "{f03337}[AdmInfo]: Admin %s l-a scos din functia de admin pe %s.", sendername,giveplayer);
ABroadCast(0xf03337FF,string,4);
new wakaname[25];
GetPlayerName(id,wakaname,25);
new str[128];
format(str,128,"UPDATE users SET `Admin`='0' WHERE `name`='%s'",wakaname);
mysql_query(SQL,str);
}
else
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[id][pAdmin] = adminlevel;
PlayerInfo[id][pChar] = 217;
SetPlayerSkin(id, 217);
printf("[AdmInfo]: %s has promoted %s to a level %d admin.", sendername, giveplayer, adminlevel);
format(string, sizeof(string), "* Felicitari! Ai fost promovat la gradul de admin level %d de catre %s!", adminlevel, sendername);
SCM(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* L-ai promovat pe %s la gradul de admin level %d!", giveplayer,adminlevel);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "[AdmInfo]: Admin %s l-a promovat pe %s la gradul de admin level %d", sendername,giveplayer,adminlevel);
ABroadCast(0xf03337FF,string,4);
new wakaname[25];
GetPlayerName(id,wakaname,25);
new str[256];
format(str,256,"UPDATE users SET `Admin`='%d',`CChar`='%d' WHERE `name`='%s'",PlayerInfo[id][pAdmin],PlayerInfo[id][pChar],wakaname);
mysql_query(SQL,str);
}
}
}
else
{
SCM(playerid, COLOR_WHITE, "Jucatorul nu este conectat.");
}
}
else
{
SCM(playerid, COLOR_WHITE, AdminOnly);
}
}
return 1;
}
{
This is an example, i know is not like that :P
}