PDA

View Full Version : I need some help..


sansk
25/09/2013, 03:00 PM
is it possible to make a /reload command to reload your weapons?

DanishHaq
25/09/2013, 03:12 PM
Yes, you can make a reload command and use

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);
}

sansk
25/09/2013, 05:01 PM
so i can do


if(GetPlayerWeapon(playerid) == 22)
{
GivePlayerWeapon(playerid, 22, 0);
GivePlayerWeapon(playerid, PlayerInfo[playerid][pWep2a]); //ammo
}

DanishHaq
25/09/2013, 05:02 PM
Yes, give it a go.

Edit: As Konstantinos said, I forgot.

You need to do:

GivePlayerWeapon(playerid, weaponid, PlayerInfo[playerid][pWep2a]);

Instead of:

GivePlayerWeapon(playerid, PlayerInfo[playerid][pWep2a]);

Obviously, weaponid being the weaponid which is an number.

Konstantinos
25/09/2013, 05:05 PM
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.

sansk
25/09/2013, 08:32 PM
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

DanishHaq
25/09/2013, 09:10 PM
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 :D.

sansk
26/09/2013, 07:19 PM
Do you know if There is a reload animation?

EiresJason
26/09/2013, 07:53 PM
Yes there is.

Go here: http://wiki.sa-mp.com/wiki/Animations

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