Equip? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Equip? (
/showthread.php?tid=112358)
Equip? -
Namaco - 07.12.2009
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?
Re: Equip? -
Abernethy - 07.12.2009
Can you help me & put this in understandable English?
Re: Equip? -
Namaco - 07.12.2009
Okay well now what i mean is to do a command only for a faction. Something like cops do duty but in other and smaller way so like
when im the position where i want to do /armyequip it will give me like 3 weapons
Re: Equip? -
Finn - 07.12.2009
Top of the script:
pawn Код:
#define ARMY_POSITION 123.0, 123.0, 123.0 // Your coords here.
Command:
pawn Код:
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;
}
Re: Equip? -
Namaco - 07.12.2009
yep thanks mate
Re: Equip? -
MenaceX^ - 07.12.2009
Quote:
Originally Posted by Finn
Top of the script:
pawn Код:
#define ARMY_POSITION 123.0, 123.0, 123.0 // Your coords here.
Command:
pawn Код:
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; }
|
Why so many returns?
Re: Equip? -
Namaco - 07.12.2009
am and i got a problem
error 047: array sizes do not match, or destination array is too small
is it bad?
Re: Equip? -
Finn - 07.12.2009
Quote:
Originally Posted by MenaceX^
Why so many returns?
|
What do you mean?
Re: Equip? -
DeathOnaStick - 07.12.2009
Quote:
Originally Posted by Finn
Quote:
Originally Posted by MenaceX^
Why so many returns?
|
What do you mean?
|
You have unnecessary returns. This would be enough:
pawn Код:
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;
}
Re: Equip? -
Finn - 07.12.2009
Quote:
Originally Posted by ∈ⅹitus
You have unnecessary returns. This would be enough:
pawn Код:
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; }
|
Looks better in my eyes with the 'unnecessary' returns.