20.04.2013, 01:00
So i've got a command to /fix a players car. I'm wondering how can you check if they have moved from their last position since entering it. By getting out of the vehicle, or driving away. So i enter /fix wait 10 seconds and if i've moved it tells me "you've moved assistance cancelled".
Here's the command
Here's the timer:
im also having problems with the timer, it spams me after the fix and takes money, hence the return 0. I've set the timer to "false" so its not repeating. Its not tested @ the time of typing so thats why it's like that. Hope you can help guys
Here's the command
Code:
CMD:fix(playerid,params[]) { new Float:health; new veh; veh = GetPlayerVehicleID(playerid); GetVehicleHealth(veh, health); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "You need to be in a vehicle to use this"); else if(health > 999) return SendClientMessage(playerid,red,"Your vehicles at 100%"); SetTimer("repairtime",10000,false); SendClientMessage(playerid,green,"Help will arrive in 10 seconds. Please wait."); return 1; }
Code:
forward repairtime(); public repairtime() { for(new i = 0; i < MAX_PLAYERS; i++) { RepairVehicle(GetPlayerVehicleID(i)); SendClientMessage(i, COLOR_SKYBLUE, "Vehicle Repaired"); GivePlayerMoney(i, -500); } return 0; }