22.02.2010, 14:28
I want that TEAM_MEDIC can drive Ambulance car and other teams cant
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(vehicleid) == 416)
{
if(!GetPlayerTeam .....
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to drive this vehicle");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
forward IsACopCar(vehicleid);
forward IsAmbulance(vehicleid);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsACopCar(vehicleid))
{
if(GetPlayerTeam(playerid) == TEAM_POLICE)
{
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to drive this vehicle");
RemovePlayerFromVehicle(playerid);
}
if(IsAmbulance(vehicleid))
{
if(GetPlayerTeam(playerid) == TEAM_MEDIC)
{
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to drive this vehicle");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
public IsACopCar(vehicleid)
{
if(GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 599)
{
return 1;
}
else return 0;
}
public IsAmbulance(vehicleid)
{
if(GetVehicleModel(vehicleid) == 416)
{
return 1;
}
else return 0;
}
warning 219: local variable "vehicleid" shadows a variable at a preceding level
new vehicleid;