Need help with team vehicle system
#3

There are two simple ways on that

OnPlayerEnterVehicle

and OnPlayerStateChange

I only can give OnPlayerEnterVehicle example
i.e

now since you have already have that scar[MAX_SCAR] if that's how that variable is made, I'll go with my idea of how it's made

first you make this piece of function
PHP код:
stock IsScar(carid//check if the car is a scar vehicle
{
    for(new 
0sizeof(Scar); v++) {
        if(
carid == Scar[v]) return 1;
    }
    return 
0;
}

public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(!
ispassenger//check if the player is not a passenger
    
{
        
SetPlayerArmedWeapon(playerid0);

           if(
IsScar(vehicleid)) 
           {
               if(
Player[playerid][ScarOwner] != vehicleid//this would just be example for removing the player 
               
{
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessage(playeridCOLOR_GRAD2"You can't right this car");
            } 
//this way the player would be removed if he does not owned that scar vehicle
        
}// you can make it if the player is not the leader of the group the scar is supposed to be used they get ejected
    
}

this can be improved with much more security if you want so that not even a hacker can move this cars
Reply


Messages In This Thread
Need help with team vehicle system - by 1fret - 22.03.2017, 19:02
Re: Need help with team vehicle system - by LEOTorres - 22.03.2017, 20:27
Re: Need help with team vehicle system - by JesterlJoker - 23.03.2017, 01:05

Forum Jump:


Users browsing this thread: 4 Guest(s)