open.mp forum
[Pawn] Help me with this cmd - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] Help me with this cmd (/showthread.php?tid=2632)



Help me with this cmd - julees - 2024-03-10

Hi all! i hava problem to make this... 
I have this godcar system and a command to flat the wheels, I want that when the godcar is activated the wheels continue to flat when it self-repairs but can't get it to work

CMD:godcar(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You need to be the driver!");
if(Active[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Godcar already enabled!");
return 1;
}
TimeFix = SetTimerEx("Fix", 200, true, "i", playerid);
SendClientMessage(playerid, COLOR_WHITE, "Godcar enabled!");
Activado[playerid] =1;
return 1;
}


and this the cmd for the flat wheels

CMD:tires(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You need to be the driver!");
{
new panels, doors, lights, tires;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 5);
}
return 1;
}

 
ty for help :D


RE: Help me with this cmd - N0FeaR - 2024-03-10

Try this

PHP Code:
new TimeFix[MAX_PLAYERS]; CMD:godcar(playerid, params[]) {     if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You need to be the driver!");     if(Active[playerid] == 1)     {         SendClientMessage(playerid, COLOR_RED, "Godcar already enabled!");         return 1;     }     TimeFix[playerid] = SetTimerEx("Fix", 200, true, "i", playerid);     SendClientMessage(playerid, COLOR_WHITE, "Godcar enabled!");     Active[playerid] = 1;     return 1; } forward Fix(playerid); public Fix(playerid) {     if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 0;     if(Active[playerid] != 1) return 0;         // Flatten tires     tires(playerid, "");     // Add other self-repair actions if needed         return 1; } CMD:tires(playerid, params[]) {     if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You need to be the driver!");     new panels, doors, lights, tires;     new vehicleid = GetPlayerVehicleID(playerid);     GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);     UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 5);     return 1; }



RE: Help me with this cmd - Goldenman - 2024-04-04

You could also make the Active variable a boolean.

PHP Code:
new bool:Active[MAX_PLAYERS]; if (Active) return SendClientMessage(playerid, COLOR_RED, "Godcar already enabled!");