20.12.2010, 21:55
I have 2 problems
1) Problem 1: when i type /a it shows 'USAGE: /a(dmin) [text]' but if i type text it only shows 'Administrator Admantis:' but the text isn't showing.
2nd Problem: I have this script which works like /givepermisson [id] [ammount] but when I type the number like /givepermisson 0 5 it will give me like 53 permissons or any random high number like 49 53 56..
Thanks
1) Problem 1: when i type /a it shows 'USAGE: /a(dmin) [text]' but if i type text it only shows 'Administrator Admantis:' but the text isn't showing.
pawn Код:
if (strcmp("/a",cmd, true) == 0 || strcmp("/admin",cmd,true)==0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /a(admin) [text]");
}
new msg = strval(tmp);
new seniormsg[128], juniormsg[128], leadmsg[128];
GetPlayerName(playerid,seniormsg,sizeof(seniormsg));
GetPlayerName(playerid,juniormsg,sizeof(juniormsg));
format(seniormsg,sizeof(seniormsg),"Senior Administrator %s: %s",seniormsg,msg);
format(juniormsg,sizeof(juniormsg),"Junior Administrator %s: %s",juniormsg,msg);
format(leadmsg,sizeof(leadmsg),"Lead Administrator %s: %s",leadmsg,msg);
if (PlayerInfo[playerid][pAdminLevel] == 1) SendAdminMessage(COLOR_LIGHTGREEN, juniormsg);
if (PlayerInfo[playerid][pAdminLevel] == 2) SendAdminMessage(COLOR_LIGHTGREEN, seniormsg);
if (PlayerInfo[playerid][pAdminLevel] == 3) SendAdminMessage(COLOR_LIGHTGREEN, leadmsg);
return 1;
}
stock SendAdminMessage(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if(PlayerInfo[i][pAdminLevel] > 0) SendClientMessage(i, color, string);
}
return 1;
}
pawn Код:
if(strcmp("/givepermisson", cmd, true) == 0)
{
if(PlayerInfo[playerid][pAdminLevel] == 3)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /givepermisson [id] [ammount]");
}
new amm[MAX_PLAYERS]; // amm = AMMount
amm = strrest(cmdtext, idx);
if (!strlen(amm)) SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /givepermisson [id] [givepermisson]");
new id = strval(tmp);
new pid = playerid;
if(!IsPlayerConnected(id))
{
return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: This player is not online!");
}
if (PlayerInfo[id][pPermissons] < 500)
{
new amsg[100];
new victimid[MAX_PLAYERS];
GetPlayerName(id, victimid, sizeof(victimid));
format(amsg,sizeof(amsg),"AdmCmd: You have given %s %d permissons!",victimid,amm);
SendClientMessage(pid,COLOR_LIGHTBLUE,amsg);
PlayerInfo[id][pPermissons] = PlayerInfo[id][pPermissons] + amm[playerid];
PlayHintSoundAtPos(playerid);
return 1;
}
else SendClientMessage(pid,COLOR_GRAY,"AdmCmd: This player already haves too many permissons (over 100)!");
}
else
{
SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
return 1;
}
}