SA-MP Forums Archive
switch weapons - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: switch weapons (/showthread.php?tid=153329)



switch weapons - Headshot1108 - 08.06.2010

Hi I like to script if a player is in a certain zone , he can not use his weapons, it switch to the fist so I mean his weapons shouldn't be deleted.


Re: switch weapons - Naxix - 08.06.2010

Код:
if(IsPlayerInRangeOfPoint(playerid,50.0,X,Y,Z);
{
   SetPlayerArmedWeapon(playerid,0);
}
change "50.0" to how big you think the area is.

and X,Y,Z to the coords.

And then put this code like in a timer, or if they teleport you cut put it OnPlayerSpawn.


Re: switch weapons - Ignas1337 - 08.06.2010

idea
find a function that is called often or is called when one switches between weapons (sorry it's been a while since i scritped sa-mp (about 2 years)) and make it so that he gets his weapon switched back to fist
OR you could make an array which would store his current weapons and remove them from his possession, leading to inability to switch old weapons, unless he obtains new with a cheat or in any other way. and when he leaves that area give the weapons from array back to him

best solution would be using both of these ideas.


Re: switch weapons - Headshot1108 - 08.06.2010

Quote:
Originally Posted by Naxix
Код:
if(IsPlayerInRangeOfPoint(playerid,50.0,X,Y,Z);
{
   SetPlayerArmedWeapon(playerid,0);
}
change "50.0" to how big you think the area is.

and X,Y,Z to the coords.

And then put this code like in a timer, or if they teleport you cut put it OnPlayerSpawn.
yes thx, and:

Quote:
Originally Posted by Izanagi
idea
find a function that is called often or is called when one switches between weapons (sorry it's been a while since i scritped sa-mp (about 2 years)) and make it so that he gets his weapon switched back to fist
OR you could make an array which would store his current weapons and remove them from his possession, leading to inability to switch old weapons, unless he obtains new with a cheat or in any other way. and when he leaves that area give the weapons from array back to him

best solution would be using both of these ideas.
why so complicated ?