[HELP]: Reseting weapons -
Areax - 23.11.2013
Hello !
Is there any way to reset only one weapon ? Not like ResetPlayerWeapons, but like ResetPlayerWeapon(playerid, weaponid);
- Weaponid - id of the weapon to reset.
I only find
this. BUt that's not what i need :/
Thanks.
Re: [HELP]: Reseting weapons -
knackworst - 23.11.2013
How is that nit what you need?
Re: [HELP]: Reseting weapons - Patrick - 23.11.2013
Resetting the ammo & the gun will reset itself, Try this function I made.
pawn Code:
stock ResetPlayerWeaponID(playerid, weaponid)
return GivePlayerWeapon(playerid, weaponid, 0);
Re: [HELP]: Reseting weapons -
Areax - 23.11.2013
Because in that ResetPlayerWeaponsEx(playerid, weapoid) is like that,
-weapoid - The list of weapons to exclude
That means, if i do like ResetPlayerWeaponsEx(playerid, 31); then it will delete all weapons, but M4 will stay, but i want to delete only M4 and other weapons will stay.
Re: [HELP]: Reseting weapons -
Areax - 23.11.2013
Quote:
Originally Posted by pds2k12
Resetting the ammo & the gun will reset itself, Try this function I made.
pawn Code:
stock ResetPlayerWeaponID(playerid, weaponid) return GivePlayerWeapon(playerid, weaponid, 0);
|
Thanks, i will try.
Re: [HELP]: Reseting weapons -
Konstantinos - 23.11.2013
Quote:
Originally Posted by pds2k12
Resetting the ammo & the gun will reset itself, Try this function I made.
pawn Code:
stock ResetPlayerWeaponID(playerid, weaponid) return GivePlayerWeapon(playerid, weaponid, 0);
|
I'm not sure about that. If you have a deagle with 500 ammo and you give 0, you should still have 500 ammo.
Anyways, I'd save the weapons/ammo in an array with GetPlayerWeaponData and if the weaponid existed, I'd reset the weapons and give them back except the weaponid you chose (note that you should know the slot of the weapon).
Re: [HELP]: Reseting weapons -
Areax - 23.11.2013
Yeah, it doesn't work.
EDIT: I don't really understand what you said :/
Re: [HELP]: Reseting weapons - Patrick - 23.11.2013
Quote:
Originally Posted by Konstantinos
I'm not sure about that. If you have a deagle with 500 ammo and you give 0, you should still have 500 ammo.
Anyways, I'd save the weapons/ammo in an array with GetPlayerWeaponData and if the weaponid existed, I'd reset the weapons and give them back except the weaponid you chose (note that you should know the slot of the weapon).
|
Just realized that LoL, How dumb Am I? I was thinking that GivePlayerWeapon works the same as SetPlayerHealth, SetPlayerMoney & SetPlayerArmour, oh-well Areax Konstantinos means something like this, I didn't test it but atleast give it a try
pawn Code:
stock RemovePlayerWeaponID(playerid, weaponid)
{
new
ArrayWeapons[12], ArrayAmmunations[12], Weapon, Ammunation;
for(new slot = 0; slot != 12; slot++) {
GetPlayerWeaponData(playerid, slot, Weapon, Ammunation);
if(Weapon != weaponid) {
GetPlayerWeaponData(playerid, slot, ArrayWeapons[slot], ArrayAmmunations[slot]);
}
}
for(new slot = 0; slot != 12; slot++) {
GivePlayerWeapon(playerid, ArrayWeapons[slot], 300);
}
ResetPlayerWeapons(playerid);
}
Re: [HELP]: Reseting weapons -
Konstantinos - 23.11.2013
pawn Code:
stock RemovePlayerWeaponEx( playerid, weaponid )
{
new
wdata[ 2 ][ 13 ],
slot
;
for( new i; i != 13; i++ )
{
GetPlayerWeaponData( playerid, i, wdata[ 0 ][ i ], wdata[ 1 ][ i ] );
if( wdata[ 0 ][ i ] == weaponid ) slot = i;
}
ResetPlayerWeapons( playerid );
for( new i; i != 13; i++ ) if( i != slot) GivePlayerWeapon( playerid, wdata[ 0 ][ i ], wdata[ 1 ][ i ] );
}
Re: [HELP]: Reseting weapons -
Areax - 23.11.2013
Quote:
Originally Posted by Konstantinos
pawn Code:
stock RemovePlayerWeaponEx( playerid, weaponid ) { new wdata[ 2 ][ 13 ], slot ; for( new i; i != 13; i++ ) { GetPlayerWeaponData( playerid, i, wdata[ 0 ][ i ], wdata[ 1 ][ i ] ); if( wdata[ 0 ][ i ] == weaponid ) slot = i; } ResetPlayerWeapons( playerid ); for( new i; i != 13; i++ ) if( i != slot) GivePlayerWeapon( playerid, wdata[ 0 ][ i ], wdata[ 1 ][ i ] ); }
|
Okay, i tried that code, but didn't really work. I am working on weapon system and i did like Shotgun and M4 are both primary weapons, so if you have M4 and then you buy Shotgun, then M4 will be deleted and Shotgun will be given.