Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include sscanf2
- #include pawn.cmd
- static const TIMER_REPAIR = 30;
- static bool:Repairing[MAX_PLAYERS];
- static RepairCount[MAX_PLAYERS];
- static RepairTimer[MAX_PLAYERS];
- main(){}
- CMD:reparar(playerid, params[])
- {
- if(!IsPlayerInAnyVehicle(playerid))
- return SendClientMessage(playerid, -1, "* Você não está conduzindo um veículo.");
- if(Repairing[playerid])
- return SendClientMessage(playerid, -1, "* Você já está reparando seu veículo.");
- Repairing[playerid] = true;
- RepairCount[playerid] = 0;
- RepairTimer[playerid] = SetTimerEx("OnRepairVehicleUpdate", 1000, true, "i", playerid);
- SendClientMessage(playerid, -1, "* Você começou a reparar seu veículo.");
- return 1;
- }
- forward OnRepairVehicleUpdate(playerid);
- public OnRepairVehicleUpdate(playerid)
- {
- if(Repairing[playerid])
- {
- if(RepairCount[playerid] >= TIMER_REPAIR)
- {
- KillTimer(RepairTimer[playerid]);
- RepairCount[playerid] = 0;
- Repairing[playerid] = false;
- RepairVehicle(GetPlayerVehicleID(playerid));
- SendClientMessage(playerid, -1, "* Veículo reparado com sucesso.");
- }
- else
- {
- new string[64];
- format(string, sizeof(string), "~r~REPARANDO VEICULO...~n~~w~%i/%i", RepairCount[playerid], TIMER_REPAIR);
- GameTextForPlayer(playerid, string, 1000, 4);
- RepairCount[playerid]++;
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment