The vehicle can be repaired every 60 seconds. Help!
#7

Код:
#include <a_samp>

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
    {
        SetTimerEx("RVehicle", 20000, false, "i", playerid);
        return 1;
    }

    return 1;
}
forward RVehicle(playerid);
public RVehicle(playerid)
{
        new currentveh; // flip
        new Float:angle; // flip
        currentveh = GetPlayerVehicleID(playerid); // flip
        GetVehicleZAngle(currentveh, angle); // flip
        SetVehicleZAngle(currentveh, angle); // flip
        SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
        RepairVehicle(GetPlayerVehicleID(playerid));
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        return 1;
}
Thanks guys for response. This code almost working fine. But when I click key '2', my car is repaired after 20 seconds, I want when I click key '2' car is repaired immediatly and next repair is available after 20 seconds.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)