20.02.2016, 09:18
hayy all i have some problem with looping. i create restricted vehicle
if i use this code work but i want use looping for next time i isert new car
any solution?
PHP код:
if(newstate == 2)// mobpabrik
{
new CarCheck = GetPlayerVehicleID(playerid);
for (new bg = 0; bg < MAX_VEHICLES; bg++) // this looping work
if(CarCheck == bangunan[bg])
{
if(PlayerInfo[playerid][pjob] != 9)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Mobil Khusus Pegawai Bangunan");
return 1;
}
}
else
for (new por = 0; por < MAX_VEHICLES; por++) // not work just mobpabrik[0] work
if(CarCheck == mobpabrik[por])
{
if(PlayerInfo[playerid][pFaction] != 3)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Kendaraan khusus pegawai pabrik");
return 1;
}
}
else
//for (new pit = 0; pit < MAX_VEHICLES; pit++) // not work just pitsa[0] work
if(CarCheck == pitsa[pit] )
{
if(PlayerInfo[playerid][pjob] != 4)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Motor khusus Pengantar pizza");
return 1;
}
}
else
for (new cor = 0; cor < MAX_VEHICLES; cor++) // same just aray [0] work
if(CarCheck == noob[cor])
{
if(GetPlayerScore(playerid)> 2)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Motor khusus newbie");
return 1;
}
}
else
for (new Remo = 0; Remo < MAX_VEHICLES; Remo++) // this is work
if(CarCheck == Polisi[Remo])
{
new iSeat = GetPlayerVehicleSeat(playerid);
if(PlayerInfo[playerid][pFaction] != 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Kendaraan khusus Polisi");
return 1;
}
}
PHP код:
if(CarCheck == mobpabrik[por]|| CarCheck == mobpabrik[1] || CarCheck == mobpabrik[2] || CarCheck == mobpabrik[3] || CarCheck == mobpabrik[4])