(1433) : warning 202: number of arguments does not match definition
CMD:robplayer(playerid,params[])
{
new
Float: pX,
Float: pY,
Float: pZ;
new pName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
new ID;
new aName[MAX_PLAYER_NAME];
new imoney = RandomEx(GetPlayerMoney(ID)); // <====== Warning Line
GetPlayerName(ID,aName,MAX_PLAYER_NAME);
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,-1,"USAGE:: /robplayer (PlayerName/ID)");
return 1;
}
if(!IsPlayerConnected(ID))
{
SendClientMessage(playerid,-1,"The player is not connected");
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,-1,"You cannot rob yourself");
return 1;
}
if (!IsPlayerInRangeOfPoint(playerid, 10.0, pX, pY, pZ)) return SendClientMessage(playerid,-1,"You need to be close to the player to rob him");
{
format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed %s and got %d ",pName,playerid,aName,ID,imoney);
SendClientMessageToAll(COLOR_BLUE,string);
GivePlayerMoney(playerid,imoney);
GameTextForPlayer(ID, "~r~ROBBED!", 3000, 5);
format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed you and got %d ",pName,playerid,imoney);
SendClientMessage(ID,COLOR_BLUE,string);
return 1;
}
}
RandomEx(min, max) { return random(max - min) + min; }
The function "RandomEx" has got two arguments to be specified. The first one is the minimum value and the second one is the maximum value. Here you must set the maximum value to the amount of cash player got and the minimum could be lower than that or 0.
|
GetPlayerMoney(ID),GetPlayerMoney(ID));
RandomEx(0, GetPlayerMoney(ID));
I'd go for:
pawn Code:
|
(2171) : error 029: invalid expression, assumed zero
CMD:admin(playerid, params[])
{
new string[128];
new sName[MAX_PLAYER_NAME];
new Message[128];
if(sscanf(params, "s", string)) return SendClientMessage(playerid, -1, "USAGE: /admin [question]");
GetPlayerName(playerid, sName, sizeof(sName));
format(Message, sizeof(Message), "[{FF0000}QUESTION{EEEEEE}] from %s: %s", sName, string);
for(new i; i < MAX_PLAYERS; i++){
if(PlayerInfo[i][pAdmin] >= 1 { // <======== Error line .
SendClientMessage(i,COLOR_YELLOW, Message);
}
}
return 1;
}
if(PlayerInfo[i][pAdmin] >= 1)
PHP Code:
Lordzy beated me |