VC:MP 0.3 > Snippet Showroom

Vehicle Fixing [ 5 Seconds ] [ Working ] [ By me ]

(1/2) > >>

mrockxkingbutt:
Add


--- Code: ---Fixing[MAX_VEHICLES];
--- End code ---

command [ put in OnPlayerCommand ]


--- Code: ---    else if (strcmp(cmd, "fix", true) == 0) {
if(Fixing[GetPlayerVehicleID(playerid)] == 1) SendClientMessage(playerid,COLOR_RED," Already Fixing This Vehicle ");
else if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,COLOR_RED," Not In Vehicle ");
else {
Fixing[GetPlayerVehicleID(playerid)] = 1;
SendClientMessage(playerid,COLOR_RED," Fixing ");
SetTimer("VehicleFixing", 10000, 0);
}
    return 1;
    }
--- End code ---

Timer


--- Code: ---forward VehicleFixing();
public VehicleFixing() {
for(new i ; i <MAX_VEHICLES;i++) {
if(Fixing[i] == 1) {
SetVehicleHealth(i, 1000);
SendClientMessageToAll(COLOR_GREEN," Vehicle Has Been Fixed ");
SetVehicleTyre(i,1);
Fixing[i] = 0;
}
}
return 1;
}

--- End code ---

Credits : ME

MatheuS:
Excuse the question, what you gain by copying others?  ???

mrockxkingbutt:

--- Quote from: MatheuS on April 04, 2014, 12:29:01 am ---Excuse the question, what you gain by copying others?  ???

--- End quote ---
Problem?

Besides..

its a working timer,

not like others...

besides its all change one

dynavolt71:
Are you cant see storm topic ?. You cant add SetTimers on Cmd. It only works on ongamemodeinit.

stormeus:

--- Quote from: dynavolt71 on April 04, 2014, 01:53:02 am ---Are you cant see storm topic ?. You cant add SetTimers on Cmd. It only works on ongamemodeinit.

--- End quote ---

Not inherently true, but this timer really should only be set in OnGameModeInit. What I said was this:


--- Quote ---You cannot pass an argument to a timer in VC:MP 0.3z r2

--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version