24.02.2012, 17:31
My timer isn't working..
The timer just work for ONE player..
SetTimer("StreamerUpdate", 1000, true);
Thanks in advance.
The timer just work for ONE player..
SetTimer("StreamerUpdate", 1000, true);
pawn Код:
forward StreamerUpdate();
public StreamerUpdate() {
for(new i = 0; i < MAX_PLAYERS; ++i) {
if(PlayerData[i][Logged] == true && IsPlayerConnected(i)) {
AccountData[i][PlayingTime] ++;
if(IsPlayerInAnyVehicle(i)) {
new
TextDrawString[128];
if(IsABicycle(GetVehicleModel(GetPlayerVehicleID(i)))) return 1;
TextDrawHideForPlayer(i, TextDrawDesign[Textdraw3]);
TextDrawHideForPlayer(i, TextDrawDesign[Textdraw2]);
new Float: vX, Float: vY, Float: vZ, Float: Speed;
GetVehicleVelocity(GetPlayerVehicleID(i), vX, vY, vZ);
Speed = floatsqroot(floatpower(vX, 2) + floatpower(vY, 2) + floatpower(vZ, 2)) * 99;
format(TextDrawString, sizeof(TextDrawString), "~g~ MPH: %0.0f~n~ Gaso: %i", Speed, CarData[GetPlayerVehicleID(i)][Fuel]);
TextDrawSetString(TextDrawDesign[Textdraw3], TextDrawString);
TextDrawShowForPlayer(i, TextDrawDesign[Textdraw3]);
TextDrawShowForPlayer(i, TextDrawDesign[Textdraw2]);
if(GetVehicleFuel(GetPlayerVehicleID(i)) < 1) {
format(TextDrawString, sizeof(TextDrawString), "~n~~n~~n~~n~~n~~n~~r~Sem gasolina!", CarData[GetPlayerVehicleID(i)][Fuel]);
GameTextForPlayer(i, TextDrawString, 1000, 5);
RemovePlayerFromVehicle(i);
CarData2[GetPlayerVehicleID(i)][Engine] = false;
TogglePlayerControllable(i, true);
}
}
else {
TextDrawHideForPlayer(i, TextDrawDesign[Textdraw3]);
TextDrawHideForPlayer(i, TextDrawDesign[Textdraw2]);
}
if(AccountData[i][JailTime] > 0) {
printf("JailTime --");
AccountData[i][JailTime] --;
if(AccountData[i][JailTime] <= 1) {
AccountData[i][Jailed] = 0;
SetPlayerPos(i, 1515.6228,-1673.2925,14.0469);
SetPlayerVirtualWorldEx(i, 0);
SetPlayerInterior(i, 0);
GameTextForPlayer(i, "~r~Livre.", 5100, 3);
SetPlayerFacingAngle(i, 87.9105);
SendClientMessage(i, -1, " Tente ser um cidadгo melhor. ");
SaveAccount(i);
printf("JailTime - Solto");
}
format(string, 128, "~r~Tempo Restante: ~b~%i", AccountData[i][JailTime]);
GameTextForPlayer(i, string, 3000, 5);
}
if(LockPicking[i] == true) {
if(CurrentTime[i] <= 0){
CurrentTime[i] = -1;
LockPicking[i] = false;
TogglePlayerControllable(i, true);
}
format(string, 90, "~r~Tempo Restante: ~b~%i", CurrentTime[i]);
GameTextForPlayer(i, string, 1100, 5);
CurrentTime[i] --;
new Float:Pos[3];
GetVehiclePos(NearestV[i], Pos[0], Pos[1], Pos[2]);
PlayerPlaySound(i, 1147, Pos[0], Pos[1], Pos[2]);
}
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK ) {
serverBan(i, INVALID_PLAYER_ID, "Jetpack hacking");
}
if(HouseMostro[i] > 0) {
HouseMostro[i]--;
}
if(EscutandoMusica[i] == true && !IsPlayerInAnyVehicle(i)) {
StopAudioStreamForPlayer(i);
EscutandoMusica[i] = false;
}
for(new a = 0, b = sizeof(HouseData); a != b; ++a) {
if(IsPlayerInRangeOfPoint(i, 5.0, HouseData[a][hPos][0], HouseData[a][hPos][1], HouseData[a][hPos][2]) && HouseData[a][hOwned] == TRUE) {
new area[TOTAL_ZONE_NAME];
Get2DZone(area, TOTAL_ZONE_NAME, HouseData[a][hPos][0],HouseData[a][hPos][1],HouseData[a][hPos][2]);
if(HouseMostro[i] == 0) {
format(string, sizeof(string), "%s, nє %d.", area, a);
SendClientMessage(i, COLOR_LSRP, string);
format(string, sizeof(string), "Os comandos sгo /entrar, /alugarcasa.", HouseData[a][hRent]);
SendClientMessage(i, COR_ESPECIAL, string);
HouseMostro[i] = 6;
SetPlayerCheckpoint(i,HouseData[a][hPos][0], HouseData[a][hPos][1], HouseData[a][hPos][2], 1.5);
}
}
}
}
}
return 1;
}
Thanks in advance.