23.03.2017, 01:05
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
this can be improved with much more security if you want so that not even a hacker can move this cars
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 v = 0; v < sizeof(Scar); v++) {
if(carid == Scar[v]) return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger) //check if the player is not a passenger
{
SetPlayerArmedWeapon(playerid, 0);
if(IsScar(vehicleid))
{
if(Player[playerid][ScarOwner] != vehicleid) //this would just be example for removing the player
{
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz);
NOPCheck(playerid);
SendClientMessage(playerid, COLOR_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
}
}