Уtimo uso do static... mas pode ser mais otimizado
pawn Код:
public OnGameModeInit() {
static i;
// Percorrer em todos os veнculos EXISTENTES!
for ( i = 1; GetVehicleModel(i) ^ 0; ++i ) {
SetVehicleParamsEx(i, 1, 1, 1, 1, 0, 0, 0);
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate) {
static
engine,lights,alarm,doors,bonnet,boot,objective,vehicleid
;
vehicleid = GetPlayerVehicleID(playerid);
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, 0, doors, bonnet, boot, objective);
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT){
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);
}
return 1;
}