Drive By Weps block
#1

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 falseDBWep2 false;
        for(new 
iisizeof(DriveBy_Weps); i++)
        {
            if(
GetPlayerWeapon(playerid) == DriveBy_Weps[i])
            {
                
SetPlayerArmedWeapon(playeridDriveBy_Weps[i]);
                
DBWep true;
                break;
            }
        }
        if(
DBWep == false)
        {
            new 
p_WepData[13][2];
            for(new 
ii13i++)
            {
                 
GetPlayerWeaponData(playeridip_WepData[i][0], p_WepData[i][1]);
                for(new 
aasizeof(DriveBy_Weps); a++)
                {
                    if(
p_WepData[i][0] == DriveBy_Weps[i] && p_WepData[i][1] >= 1)
                    {
                        
SetPlayerArmedWeapon(playeridDriveBy_Weps[i]);
                        
DBWep2 true;
                        break;
                    }
                }
                if(
>= 12 && !DBWep2)
                {
                    
SetPlayerArmedWeapon(playerid0);
                    break;
                }
            }
        }
    } 
BUT IT DO NOT WORK PLEASE HELP
Reply
#2

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;
}
Reply
#3

didn't work
the player has no weapon
Reply
#4

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?
Reply
#5

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
Reply
#6

help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)