#define Civil 0
#define Samu 1
new MEDICOS[16];
public OnGameModeInit();
{
MEDICOS[0] = AddStaticVehicleEx(416,1177.7000000,-1337.0000000,14.1000000,270.0000000,255,255,15); //Ambulance
MEDICOS[1] = AddStaticVehicleEx(416,1177.5996000,-1340.7002000,14.1000000,270.0000000,255,255,15); //Ambulance
MEDICOS[2] = AddStaticVehicleEx(416,1176.9000000,-1307.0000000,14.1000000,270.0000000,255,255,15); //Ambulance
MEDICOS[3] = AddStaticVehicleEx(416,1177.0000000,-1310.3000000,14.1000000,270.0000000,255,255,15); //Ambulance
MEDICOS[4] = AddStaticVehicleEx(563,1182.2000000,-1382.8000000,24.9000000,270.0000000,255,255,15); //Raindance
MEDICOS[5] = AddStaticVehicleEx(563,1182.6000000,-1372.2000000,24.9000000,270.0000000,255,255,15); //Raindance
MEDICOS[6] = AddStaticVehicleEx(416,1178.3000000,-1362.0000000,14.1000000,270.0000000,255,255,15); //Ambulance
MEDICOS[7] = AddStaticVehicleEx(416,1178.4000000,-1357.4000000,14.1000000,270.0000000,255,255,15); //Ambulance
MEDICOS[8] = AddStaticVehicleEx(586,1182.2000000,-1333.6000000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[9] = AddStaticVehicleEx(586,1182.2002000,-1331.7998000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[10] = AddStaticVehicleEx(586,1182.2000000,-1330.0000000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[11] = AddStaticVehicleEx(586,1182.1000000,-1317.5000000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[12] = AddStaticVehicleEx(586,1182.1000000,-1315.8000000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[13] = AddStaticVehicleEx(586,1182.0996000,-1314.0000000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[14] = AddStaticVehicleEx(586,1182.1000000,-1312.3000000,13.2000000,270.0000000,255,255,15); //Wayfarer
MEDICOS[15] = AddStaticVehicleEx(586,1182.3000000,-1335.3000000,13.2000000,270.0000000,255,255,15); //Wayfarer
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new carros = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == 2)
{
for(new i = 0; i < sizeof(MEDICOS); i ++)
{
if(carros == MEDICOS[i])
{
if(PlayerDados[playerid][Emprego] != 1)
{
Msg(playerid,0xFF0000FF, "• Vocк nгo trabalha no Hospital e por isso que vocк nao pode pegar esse veiculo •");
RemovePlayerFromVehicle(playerid);
}
}
}
}
}
return 1;
}
stock NomeEmprego(playerid)
{
new TextoEmprego[64];
if(PlayerDados[playerid][Emprego] == 0)
{
TextoEmprego = "Civil";
}
if(PlayerDados[playerid][Emprego] == 1)
{
TextoEmprego = "Samu";
}
if(PlayerDados[playerid][Emprego] == 2)
{
TextoEmprego = "Taxista";
}
return TextoEmprego;
}
Pelo o que entendi no seu codigo, vocк nгo esta fazendo um Loop em todos os carros do servidor, esta apenas fazendo em 16 carros
|
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new carros = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof(MEDICOS); i ++)
{
if(carros == MEDICOS[i])
{
if(PlayerDados[playerid][Emprego] != 1)
{
Msg(playerid,0xFF0000FF, "• Vocк nгo trabalha no Hospital e por isso que vocк nao pode pegar esse veiculo •");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
pawn Код:
|
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new carros = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof(MEDICOS); i ++)
{
if(carros == MEDICOS[i])
{
if(PlayerDados[playerid][Emprego] != 1)
{
Msg(playerid,0xFF0000FF, "• Vocк nгo trabalha no Hospital e por isso que vocк nao pode pegar esse veiculo •");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
pawn Код:
|