SA-MP Forums Archive
I need some help.. - 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)
+--- Thread: I need some help.. (/showthread.php?tid=466012)



I need some help.. - sansk - 25.09.2013

is it possible to make a /reload command to reload your weapons?


Re: I need some help.. - DanishHaq - 25.09.2013

Yes, you can make a reload command and use

pawn Code:
if(GetPlayerWeapon(playerid) == 38)
{
     GivePlayerWeapon(playerid, 38, 0);
     GivePlayerWeapon(playerid, 38, 100); /* this will inevitably reset the weapon ID 38 and give him
100 ammo so the command can't be abused and he can keep getting ammo */

}
if(GetPlayerWeapon(playerid) == 20) // and then continue to do this...
{
     GivePlayerWeapon(playerid, 20, 0);
     GivePlayerWeapon(playerid, 20, 100);
}



Re: I need some help.. - sansk - 25.09.2013

so i can do
Code:
if(GetPlayerWeapon(playerid) == 22)
{
     GivePlayerWeapon(playerid, 22, 0);
     GivePlayerWeapon(playerid, PlayerInfo[playerid][pWep2a]); //ammo
}



Re: I need some help.. - DanishHaq - 25.09.2013

Yes, give it a go.

Edit: As Konstantinos said, I forgot.

You need to do:

pawn Code:
GivePlayerWeapon(playerid, weaponid, PlayerInfo[playerid][pWep2a]);
Instead of:

pawn Code:
GivePlayerWeapon(playerid, PlayerInfo[playerid][pWep2a]);
Obviously, weaponid being the weaponid which is an number.


Re: I need some help.. - Konstantinos - 25.09.2013

Don't forget the GivePlayerWeapon function has 3 parameters.

playerid
weaponid
ammo


In the above example of you, you have 2 parameters only and that will give you a warning.


Re: I need some help.. - sansk - 25.09.2013

Thanks guys you gave me the idea of using timers and stuff.. (Like when u press 'r' you will get 0 ammo and it will send you a client message 'reloading'.. (Or a gametext) and you will have to wait 3 sec and then you will get your ammo back


Re: I need some help.. - DanishHaq - 25.09.2013

Quote:
Originally Posted by sansk
View Post
Thanks guys �� you gave me the idea of using timers and stuff.. (Like when u press 'r' you will get 0 ammo and it will send you a client message 'reloading'.. (Or a gametext) and you will have to wait 3 sec and then you will get your ammo back
That's a great idea, good thinking .


Re: I need some help.. - sansk - 26.09.2013

Do you know if There is a reload animation?


Re: I need some help.. - EiresJason - 26.09.2013

Yes there is.

Go here: https://sampwiki.blast.hk/wiki/Animations

Press CONTROL+F and type 'reload', just flick through the different ones.