16.05.2014, 08:18
I've thought of a code but im not sure if its correct , or if it will work .
First of all here is the warning code:
Pawn code:
First of all here is the warning code:
Code:
(1433) : warning 202: number of arguments does not match definition
pawn Code:
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;
}
}
pawn Code:
RandomEx(min, max) { return random(max - min) + min; }