new CarroJornal[14];
forward IsJornalCar(playerid);
CarroJornal[0] = CreateVehicle(510, 1673.2, -1720.7, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (1)
CarroJornal[1] = CreateVehicle(510, 1670.9, -1720.8, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (2)
CarroJornal[2] = CreateVehicle(510, 1668.6, -1720.9, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (3)
CarroJornal[3] = CreateVehicle(510, 1666.3, -1721.0, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (4)
CarroJornal[4] = CreateVehicle(510, 1663.9, -1721.1, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (5)
CarroJornal[5] = CreateVehicle(510, 1661.9, -1721.2, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (6)
CarroJornal[6] = CreateVehicle(510, 1659.5, -1721.3, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (7)
CarroJornal[7] = CreateVehicle(510, 1657.1, -1721.4, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (8)
CarroJornal[8] = CreateVehicle(510, 1654.9, -1721.4, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (9)
CarroJornal[9] = CreateVehicle(510, 1652.8, -1721.4, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (10)
CarroJornal[10] = CreateVehicle(510, 1650.7, -1721.5, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (11)
CarroJornal[11] = CreateVehicle(510, 1648.4, -1721.5, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (12)
CarroJornal[12] = CreateVehicle(510, 1646.1, -1721.6, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (13)
CarroJornal[13] = CreateVehicle(510, 1644.1, -1721.5, 20.2, 0.0, 95, 10, 400); // vehicle (Mountain Bike) (14)
public IsJornalCar(playerid)
{
for(new c = 0; c <= 14; c++)
{
if(IsPlayerInVehicle(playerid, CarroJornal[c]) && Player[playerid][pProf] != 2)
{
SendClientMessage(playerid, CorErro, "|ERRO| Esse veiculo й exclusivo dos Entregadores de Jornal!");
RemovePlayerFromVehicle(playerid);
return 1;
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER) IsJornalCar(playerid);
return 1;
}
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { for(new c = 0; c <= 14; c++) { if(IsPlayerInVehicle(playerid, CarroJornal[c]) && Player[playerid][pProf] != 2) { SendClientMessage(playerid, CorErro, "|ERRO| Esse veiculo й exclusivo dos Entregadores de Jornal!"); RemovePlayerFromVehicle(playerid); return 1; } } return false; } |
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { for(new c = 0; c <= 14; c++) { if(IsPlayerInVehicle(playerid, CarroJornal[c]) && Player[playerid][pProf] != 2) { SendClientMessage(playerid, CorErro, "|ERRO| Esse veiculo й exclusivo dos Entregadores de Jornal!"); RemovePlayerFromVehicle(playerid); return 1; } } return false; } caso queira transformar sua callback em um funзгo, remova a 'public' que no caso ficaria Код:
IsJornalCar(playerid) { for(new c = 0; c <= 14; c++) { if(IsPlayerInVehicle(playerid, CarroJornal[c]) && Player[playerid][pProf] != 2) { SendClientMessage(playerid, CorErro, "|ERRO| Esse veiculo й exclusivo dos Entregadores de Jornal!"); RemovePlayerFromVehicle(playerid); } } return true; } |
for(new c = 0; c <= 14; c++)
for(new c = 0; c < sizeof(CarroJornal[]); c++)
IsJornalCar(playerid)
{
...
}
if(Player[playerid][pProf] == 2 && IsPlayerInAnyVehicle(playerid, CarroJornal[c]))
{
// ...
}
else
{
ClearAnimations(playerid);
}
Acho que ta errado e o sinal != tenta mudar pra ==
PHP код:
|