[Tutorial] Server Sided Wepons
#21

Sure
Reply
#22

Ok question/problem. One bug i found with this is when you give a player a weapon and then the player uses all the ammo up the weapon dissapers from the player, the player can now spawn that weopon from then on or untill the player weapons get reset. I imaging there is a way to get players weapon ammo and if its 0 set the variable to false? It something i was thinking about when i was going through your Tutorial and once i got it to work i tryed it with a parachute pickup and then a weapon command with 10 ammo and para and the weapon i could hack the weapon and even use it the old way like GivePlayerWeapon(playerid,weaponid,ammo); untill the player weapons got reset.
Reply
#23

perfect,Works like a charm if you get it installed right...(I'm using this!!!!!!!!)
Reply
#24

You're correct on that. If someone runs out of ammo, the variable is still on true so he can spawn with cheats the same weapon.

I'd recommend to reset the variable to false.

pawn Код:
// Loop through weapons - an example
if( GetPlayerWeaponState( playerid ) == WEAPONSTATE_NO_BULLETS )
{
    // Reset the variable to false
}
Long time ago, I made the same server-side weapons and it works perfect. It notices the admins whoever uses a weapons that is not register to the mode.
Reply
#25

really helped....
Nice work mate..
Reply
#26

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You're correct on that. If someone runs out of ammo, the variable is still on true so he can spawn with cheats the same weapon.

I'd recommend to reset the variable to false.

pawn Код:
// Loop through weapons - an example
if( GetPlayerWeaponState( playerid ) == WEAPONSTATE_NO_BULLETS )
{
    // Reset the variable to false
}
Long time ago, I made the same server-side weapons and it works perfect. It notices the admins whoever uses a weapons that is not register to the mode.
If you hold down aim and fire, some weapons will stay in your hands, even when they've run out of ammo.

That'd cause some false bans
-----
Also, updated.
Reply
#27

Beautiful, very helpful thank you so much.
Reply
#28

Quote:
Originally Posted by billy123321
Посмотреть сообщение
Beautiful, very helpful thank you so much.
Ayy lmao
Reply
#29

Quote:
Originally Posted by Snipa
Посмотреть сообщение
If you hold down aim and fire, some weapons will stay in your hands, even when they've run out of ammo.

That'd cause some false bans
-----
Also, updated.
Actually if you use WEPONSTATE_LAST_BULLET and then check for ammo it won't be false bans no more.

Also you could put all that code under OnPlayerKeyStateChange which would be more logical instead of looping thru all players checking for false weapons.
Reply
#30

I tried this under onplayerkeystate not working.

Код:
	if(newkeys & KEY_FIRE)
    {
                new weaponid = GetPlayerWeapon(playerid);
    	 	if( GetPlayerWeaponState(weaponid) == WEAPONSTATE_LAST_BULLET )
			{
				SSWeapon[playerid][weaponid] = false;
			//	SendClientMessage(playerid, 0xFF0000FF, "Weapon Empty Reseted-");
				return 1;
			}
}
Reply
#31

Quote:
Originally Posted by MBilal
Посмотреть сообщение
I tried this under onplayerkeystate not working.

Код:
	if(newkeys & KEY_FIRE)
    {
                new weaponid = GetPlayerWeapon(playerid);
    	 	if( GetPlayerWeaponState(weaponid) == WEAPONSTATE_LAST_BULLET )
			{
				SSWeapon[playerid][weaponid] = false;
			//	SendClientMessage(playerid, 0xFF0000FF, "Weapon Empty Reseted-");
				return 1;
			}
}
"GetPlayerWeaponState(playerid)" not "GetPlayerWeaponState(weaponid)"
Reply
#32

Before you can even consider implementing a server-side weapon system, you need to compensate for weapons obtained from client-side events:
- Ammunation
- Certain vehicles - golf cart giving you a golf club for example
- Pickups
- Weapons from AddPlayerClass
- Any others

EDIT: Just seen the date of the OP
Reply
#33

I honestly never knew a golf cart gave a club but he did mention it at the bottom of the post,
Quote:
Originally Posted by Original Post
Oh, almost forgot! Be sure to give a parachute on spawn or script a workaround. Also for police cars and the caddy.
Reply
#34

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Golf carts give you a golf club? Are you sure?
they used to
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)