02.08.2012, 17:47
Hey guys,
Today I found a problem, when i try to set a players admin level in blablabla, it works good, but the admin didnt get a message that he has set his level to blablabla.
But now I tried to make a message that the admin who want to set a players level in blablabla got a message namely: Succes, you have succesfully set %s's level granted to %d.
I was trying if it works but it wont, after I do /level blablabla my server is offline.
Anyone who see that this is wrong?
And when I was try to ban a people he is banned succesfully but, when i will do the reason you didnt see the full reason that I was just to add, And when a player try to join the server I ddint see a message just likes this: Mickos0087 has been automatically kicked (banned).
Thats just a example I didnt know how to do that,
Code:
Anyone that know how I can fix that problems?
Thanks
Today I found a problem, when i try to set a players admin level in blablabla, it works good, but the admin didnt get a message that he has set his level to blablabla.
But now I tried to make a message that the admin who want to set a players level in blablabla got a message namely: Succes, you have succesfully set %s's level granted to %d.
I was trying if it works but it wont, after I do /level blablabla my server is offline.
Anyone who see that this is wrong?
PHP код:
dcmd_level(playerid,params[])
{
new tmp2[300],tmp[300], Index;
tmp = strtok(params,Index), tmp2 = strtok(params,Index);
new id = strval(tmp), level = strval(tmp2);
if(IsPlayerAdminLevel(playerid,5))
{
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_ORANGE,"That player is not connected");//if player not connected
new str[256],aname[128];
GetPlayerName(playerid,aname,sizeof(aname));
format(str,sizeof(str),"Succes, Admin level %d has granted to you by Admin %s.",aname);//message to player
format(str,sizeof(str),"Succes, you have succesfully set %s's level granted to %d.",aname);//message to admin
SendClientMessage(id,COLOR_YELLOW,str);
Stats[id][AdminLvl] = level;
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"Sorry, only admins level 5+ can do that command.");
}
return 1;
}
Thats just a example I didnt know how to do that,
Code:
PHP код:
dcmd_ban(playerid,params[]) {
if(Stats[playerid][AdminLvl] >= 1)
{
new tmp[256], tmp2[256], Index;
tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid,COLOR_ORANGE, "You must be type /ban <playerid> <reason>");
if(!strlen(tmp2)) return SendClientMessage(playerid,COLOR_ORANGE, "ERROR: No reason specified.");
new id, pn[120], aname[120], string[128];
id = strval(tmp);
if(Stats[id][AdminLvl] >= Stats[playerid][AdminLvl]) return SendClientMessage(playerid,COLOR_ORANGE,"You cant ban this admin.");
GetPlayerName(id, pn, sizeof(pn));
GetPlayerName(playerid, aname, sizeof(aname));
format(string,sizeof(string),"%s has been banned by Admin %s [Reason: %s]",pn,aname,params[2]);
SendClientMessageToAll(COLOR_RED,string);
BanEx(id, string);
}
else return SendClientMessage(playerid,COLOR_ORANGE,"Sorry, only admins level 1+ can do that command.");
return 1;
}
Thanks