08.07.2012, 01:20
this is mine. hope it works
pawn Код:
new OnPlayerUpdateExTimer[MAX_PLAYERS];
new bool:godcar[MAX_PLAYERS];
forward OnPlayerUpdateEx(playerid);
public OnPlayerConnect(playerid)
{
OnPlayerUpdateExTimer[playerid] = SetTimerEx("OnPlayerUpdateEx", 1000, true, "i", playerid);
godcar[playerid] = false;
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(OnPlayerUpdateExTimer[playerid]);
godcar[playerid] = false;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/godcar", cmdtext, true, 10) == 0)
{
if(godcar[playerid] == false)
{
godcar[playerid] = true;
SendClientMessage(playerid, -1, "Activated!");
}
else
if(godcar[playerid] == true)
{
godcar[playerid] = false;
SendClientMessage(playerid, -1, "DeActivated!");
}
return 1;
}
return 0;
}
public OnPlayerUpdateEx(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(godcar[playerid] == true)
{
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
}
}
}