07.12.2009, 05:39
Aye i need help i wanted to do stuff like /armyequip that gives that ammount and that in the pos i want and i dunnoh how to do it could anyone help me?
#define ARMY_POSITION 123.0, 123.0, 123.0 // Your coords here.
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/armyequip", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, ARMY_POSITION)) // You can change the range from 3.0 to anything you'd like.
{
GivePlayerWeapon(playerid, 24, 100); // Give deagle with 100 ammo.
GivePlayerWeapon(playerid, 29, 300); // Give MP5 with 300 ammo.
GivePlayerWeapon(playerid, 31, 400); // Give M4 with 400 ammo.
return SendClientMessage(playerid, 0xFFFFFFFF, "You got the weapons.");
}
return SendClientMessage(playerid, 0xFFFFFFFF, "You're not at the army position.");
}
return 1;
}
Originally Posted by Finn
Top of the script:
pawn Код:
pawn Код:
|
Originally Posted by MenaceX^
Why so many returns?
|
Originally Posted by Finn
Quote:
|
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/armyequip", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, ARMY_POSITION)) // You can change the range from 3.0 to anything you'd like.
{
GivePlayerWeapon(playerid, 24, 100); // Give deagle with 100 ammo.
GivePlayerWeapon(playerid, 29, 300); // Give MP5 with 300 ammo.
GivePlayerWeapon(playerid, 31, 400); // Give M4 with 400 ammo.
SendClientMessage(playerid, 0xFFFFFFFF, "You got the weapons.");
}
else SendClientMessage(playerid, 0xFFFFFFFF, "You're not at the army position.");
}
return 1;
}
Originally Posted by ∈ⅹitus
You have unnecessary returns. This would be enough:
pawn Код:
|