02.04.2009, 15:31
Hi, i've got big problems with my timers and bools, so i want to know how i can use timers and bools the best?
Because, i had with my timers:
One timer of 1 secon, allways on, and one timer from Fallouts Speedometer, every 0,2 sec. The first timer i used, was for IsPlayerInArea, where i made an DM script. If you enter the area, godmode was turned of. If you leave the area, godmode was on. But last, godmode was always off or always on
.
Script:
And my error with booleans. I made is vehicle spawn tool, for all players. They can spawn vehicles, as a infernus, and if they want a new vehicle to spawn, the other will be destroyed. It all time worked, until the last time. If someone spawn a vehicle, and drive it, suddenly their vehicle is gone
Or someone on a vehicle is teleported to him 
Code:
How can i prevent my errors?
PS: Sorry for my bad english
Because, i had with my timers:
One timer of 1 secon, allways on, and one timer from Fallouts Speedometer, every 0,2 sec. The first timer i used, was for IsPlayerInArea, where i made an DM script. If you enter the area, godmode was turned of. If you leave the area, godmode was on. But last, godmode was always off or always on

Script:
Код:
new DM[MAX_PLAYERS]; new Area69[MAX_PLAYERS]; forward isPlayerInArea(playerid); public OnGameModeInit() { SetTimer("isPlayerInArea",1000, true); } public isPlayerInArea(playerid) { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(playerid, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if (X <= 430.6979 && X >= -78.8838 && Y <= 2134.8264 && Y >= 1630.9531) { if (Area69melding[playerid] ==0) { Area69melding[playerid] = 1; DM[playerid] = 1; GivePlayerWeapon(playerid, 23, 400); GivePlayerWeapon(playerid, 29, 300); GivePlayerWeapon(playerid, 31, 150); } } else { Area69melding[playerid] = 0; DM[playerid] = 0; } if (DM[playerid] == 0 ) { if(adminlevel[playerid] < 3) { ResetPlayerWeapons(playerid); } else { ResetPlayerWeapons(playerid); } new Float:Health; new Float:Armor; GetPlayerHealth(playerid,Health); GetPlayerArmour(playerid, Armor); if (Health < 100.0) { SetPlayerHealth(playerid,100.0); } if (Armor < 100.0) { SetPlayerArmour(playerid,100.0); } if (IsPlayerInAnyVehicle(playerid) == 1) { new PlayerCar; new Float:CarHealth; PlayerCar = GetPlayerVehicleID(playerid); GetVehicleHealth(PlayerCar,CarHealth); if (CarHealth < 1000.0) { SetVehicleHealth(PlayerCar, 1000.0); } } } } }


Code:
Код:
new Vehicle[MAX_PLAYERS]; new bool:VehicleSpawned[MAX_PLAYERS]; public OnPlayerCommandText(playerid, cmdtext[]) { new Float:px, Float:py, Float:pz, Float:pa; if (strcmp("/infernus", cmdtext, true) == 0) { if(VoertuigSpawned[playerid] == true) { DestroyVehicle(Voertuig[playerid]); } VoertuigSpawned[playerid] = true; GetPlayerFacingAngle(playerid,pa); GetPlayerPos(playerid, px, py, pz); Voertuig[playerid] = CreateVehicle(411, px+5, py, pz, pa,-1, -1,600000); SendClientMessage(playerid, GREEN,"Spawned a Infernus!"); format(string, sizeof(string), "%s (ID %d) Has spawned a Infernus", name, playerid); print(string); return 1; } return SendClientMessage(...); )
PS: Sorry for my bad english
