27.09.2012, 20:53
Well, I got a little problem with a command for selling guns and here it is -
But when I try to sell to someone, it says "You are too far away from that player" or either "You can only take 1-400 bullets at once!"...
I've also added this function:
Did I forgot something ? It compiles fine and Im just confused, should I add "playerid" at "new playerb, bullets;" ?
Or If someone can make it working, thanks in advance.
Everyone who atleast try to help me will be +Repped x)
Код:
if(strcmp(cmdtext,"/sellak",true)==0)
{
new playerb, bullets;
if(gTeam[playerid] != TEAM_GUNDEALERS) return SendClientMessage(playerid,COLOR_RED,"You are not Emmet's Place Worker!");
if(!IsPlayerNearPlayer(playerid, playerb, 5)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
if(bullets < 1 || > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
SendClientMessage(playerb, 0xFF9900AA, "Emmet Worker has given you a AK-47 and a box of ammo.");
GivePlayerWeapon(playerb, 30, bullets);
GivePlayerMoney(playerid, -500);
return 1;
}
I've also added this function:
Код:
stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
{
return 1;
}
return 0;
}
Or If someone can make it working, thanks in advance.
Everyone who atleast try to help me will be +Repped x)

