05.01.2011, 18:30
First Error:
2nd Error: When I do a admin command it's uspposed to tell only to admins what he did, but it doesn't.
Thanks ALOT to whoever fixes my probs.
pawn Код:
error 035: argument type mismatch (argument 1)
if (!IsNumeric(money)) return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: Invalid ammount.");
stock IsNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
pawn Код:
if(strcmp(cmd, "/money", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /money [id] [money]");
return 1;
}
new playa;
new money;
playa = strval(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (!IsNumeric(money)) return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: Invalid ammount.");
if (PlayerInfo[playerid][pAdminLevel] == 3)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new string[128], name[28], giveplayer[28];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
PlayerInfo[playerid][pMoney] += money;
format(string,sizeof(string), "AdmWarn: Lead Administrator %s has given %d$ to %s.",name, money, giveplayer);
SendAdminMessage(COLOR_LIGHTBLUE,string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAY, "You don't have authorization.");
}
}
return 1;
}
// Tho it gives money properly, no admin message is sent.
stock SendAdminMessage(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if(PlayerInfo[i][pIsGolden] == 1) SendClientMessage(i, color, string);
}
return 1;
}