Drive By Weps block - 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)
+--- Thread: Drive By Weps block (
/showthread.php?tid=602406)
Drive By Weps block -
ayoub001 - 06.03.2016
i want that when a player is in car as a passenger hi can not use these weapons ::
PHP код:
new DriveBy_Weps[] =
{
22,
23,
24,
28,
29,
30,
31,
32};
public OnPlayerStateChange(playerid, newstate, oldstate)
>>
PHP код:
if(newstate == PLAYER_STATE_PASSENGER)
{
new bool:DBWep = false, DBWep2 = false;
for(new i; i< sizeof(DriveBy_Weps); i++)
{
if(GetPlayerWeapon(playerid) == DriveBy_Weps[i])
{
SetPlayerArmedWeapon(playerid, DriveBy_Weps[i]);
DBWep = true;
break;
}
}
if(DBWep == false)
{
new p_WepData[13][2];
for(new i; i< 13; i++)
{
GetPlayerWeaponData(playerid, i, p_WepData[i][0], p_WepData[i][1]);
for(new a; a< sizeof(DriveBy_Weps); a++)
{
if(p_WepData[i][0] == DriveBy_Weps[i] && p_WepData[i][1] >= 1)
{
SetPlayerArmedWeapon(playerid, DriveBy_Weps[i]);
DBWep2 = true;
break;
}
}
if(i >= 12 && !DBWep2)
{
SetPlayerArmedWeapon(playerid, 0);
break;
}
}
}
}
BUT IT DO NOT WORK PLEASE HELP
Re: Drive By Weps block -
AdmBot - 06.03.2016
Use this:
Код:
stock IsDBWeapon(weaponid)
{
if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32) return 1;
return 0;
}
Re: Drive By Weps block -
ayoub001 - 06.03.2016
didn't work
the player has no weapon
Re: Drive By Weps block -
Puppy - 06.03.2016
I'm just going to come and say right now that an array isn't really needed here unless you use it in other numerous areas. This just uses up extra resources using your current data structure.
Moving on, be more specific. What doesn't work? What have you done to try to debug the issue?
Re: Drive By Weps block -
ayoub001 - 06.03.2016
now when a player is on foot hi has all his weapon and when hi is a PASSANGER hi lost all his weapons and when he come back on foot the weapons con back too
Re: Drive By Weps block -
ayoub001 - 06.03.2016
help