forward color3(playerid); public color3(playerid) { new vehicle; vehicle = GetPlayerVehicleID(playerid); if(vehicle > 0) { new r = random(sizeof(CarColors)); new r1 = random(sizeof(CarColors)); ChangeVehicleColor(vehicle, CarColors[r], CarColors[r1]); } }
forward color3(playerid); public color3(playerid) { new vehicle; vehicle = GetPlayerVehicleID(playerid); if(vehicle >= 0) { new r = random(sizeof(CarColors)); new r1 = random(sizeof(CarColors)); ChangeVehicleColor(vehicle, CarColors[r], CarColors[r1]); } }
forward color3(playerid); public color3(playerid) { new vehicle; vehicle = GetPlayerVehicleID(playerid); if(vehicle >= 0) { new r = random(sizeof(CarColors)); new r1 = random(sizeof(CarColors)); ChangeVehicleColor(vehicle, CarColors[r], CarColors[r1]); } }
if(vehicle >= 0)
why only for id 0?
Код:
forward color3(playerid); public color3(playerid) { new vehicle; vehicle = GetPlayerVehicleID(playerid); if(vehicle > 0) { new r = random(sizeof(CarColors)); new r1 = random(sizeof(CarColors)); ChangeVehicleColor(vehicle, CarColors[r], CarColors[r1]); } } |
// Add player classes [20:44:42] index 0 playerid 0 skin 0 // Player1 [20:44:42] index 1 playerid 1 skin 0 // Player2 [20:44:42] index 2 playerid 2 skin 0 // Player3 // Add static vehicles [20:44:42] index 0 vehicleid 0 model 0 // Empty [20:44:42] index 1 vehicleid 1 model 596 // Car1 [20:44:42] index 2 vehicleid 2 model 596 // Car2 [20:44:42] index 3 vehicleid 3 model 596 // Car3
forward color3(playerid);
public color3(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if (vehicleid) // If ID 1 Car defined If 0 no exist
{
ChangeVehicleColor(vehicleid, random(sizeof(CarColors), random(sizeof(CarColors));
return true;
}
return false;
}
NOTE:
* All players ID of 0 to 999 * All vehicles ID of 1 to 2000 Server log: Код:
// Add player classes [20:44:42] index 0 playerid 0 skin 0 // Player1 [20:44:42] index 1 playerid 1 skin 0 // Player2 [20:44:42] index 2 playerid 2 skin 0 // Player3 // Add static vehicles [20:44:42] index 0 vehicleid 0 model 0 // Empty [20:44:42] index 1 vehicleid 1 model 596 // Car1 [20:44:42] index 2 vehicleid 2 model 596 // Car2 [20:44:42] index 3 vehicleid 3 model 596 // Car3 PHP код:
|