SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/09/2013, 03:00 PM   #1
sansk
Big Clucker
 
Join Date: Aug 2013
Posts: 65
Reputation: -2
Question I need some help..

is it possible to make a /reload command to reload your weapons?
sansk is offline   Reply With Quote
Old 25/09/2013, 03:12 PM   #2
DanishHaq
High-roller
 
Join Date: Sep 2011
Location: Manchester, England, United Kingdom
Posts: 1,351
Reputation: 134
Default Re: I need some help..

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);
}
DanishHaq is offline   Reply With Quote
Old 25/09/2013, 05:01 PM   #3
sansk
Big Clucker
 
Join Date: Aug 2013
Posts: 65
Reputation: -2
Question Re: I need some help..

so i can do
Code:
if(GetPlayerWeapon(playerid) == 22)
{
     GivePlayerWeapon(playerid, 22, 0);
     GivePlayerWeapon(playerid, PlayerInfo[playerid][pWep2a]); //ammo
}
sansk is offline   Reply With Quote
Old 25/09/2013, 05:02 PM   #4
DanishHaq
High-roller
 
Join Date: Sep 2011
Location: Manchester, England, United Kingdom
Posts: 1,351
Reputation: 134
Default Re: I need some help..

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.
DanishHaq is offline   Reply With Quote
Old 25/09/2013, 05:05 PM   #5
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: I need some help..

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.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 25/09/2013, 08:32 PM   #6
sansk
Big Clucker
 
Join Date: Aug 2013
Posts: 65
Reputation: -2
Default Re: I need some help..

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
sansk is offline   Reply With Quote
Old 25/09/2013, 09:10 PM   #7
DanishHaq
High-roller
 
Join Date: Sep 2011
Location: Manchester, England, United Kingdom
Posts: 1,351
Reputation: 134
Default Re: I need some help..

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 .
DanishHaq is offline   Reply With Quote
Old 26/09/2013, 07:19 PM   #8
sansk
Big Clucker
 
Join Date: Aug 2013
Posts: 65
Reputation: -2
Default Re: I need some help..

Do you know if There is a reload animation?
sansk is offline   Reply With Quote
Old 26/09/2013, 07:53 PM   #9
EiresJason
Gangsta
 
Join Date: Mar 2013
Location: Dublin.
Posts: 685
Reputation: 76
Default Re: I need some help..

Yes there is.

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

Press CONTROL+F and type 'reload', just flick through the different ones.
EiresJason is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 07:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.