SA-MP Forums Archive
Repair car - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Repair car (/showthread.php?tid=92101)



Repair car - Goobiiify - 18.08.2009

I have tried to figure out this problem with doing a Command called /fix but I fail everytime I doing it.
Could someone post a exemple on how it could look like, please.

//Al


Re: Repair car - JaTochNietDan - 18.08.2009

pawn Код:
if(strcmp(cmdtext,"/fix",true) == 0)
{
  if(GetPlayerState != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,red,"You need to be driving a vehicle!");
  SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
  SendClientMessage(playerid,COLOR_YELLOW,"Vehicle fixed");
  return 1;
}
There's a simple example for you


Re: Repair car - Goobiiify - 18.08.2009

Quote:
Originally Posted by JaTochNietDan
pawn Код:
if(strcmp(cmdtext,"/fix",true) == 0)
{
  if(GetPlayerState != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,red,"You need to be driving a vehicle!");
  SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
  SendClientMessage(playerid,COLOR_YELLOW,"Vehicle fixed");
  return 1;
}
There's a simple example for you
I started yesterday to script and I'm not the best on script.
here you got the repair script that I tried to get working.

pawn Код:
if (strcmp("/fix",cmdtext,true)==0){
IsPlayerInAnyVehicle(playerid);
SetVehicleHealth(vehicleid,1000.0);
SendClientMessage(playerid,TEAM_slytherin_COLOR,"Car is repaired.");
return 1;
  }



Re: Repair car - Weirdosport - 18.08.2009

pawn Код:
if (!strcmp("/fix",cmdtext,true))
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
        SendClientMessage(playerid,TEAM_slytherin_COLOR, "Car is repaired.");
    }
    return 1;
}
That's more along the lines of what you were doing.


Re: Repair car - Goobiiify - 18.08.2009

Quote:
Originally Posted by Weirdosport
pawn Код:
if (!strcmp("/fix",cmdtext,true))
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
        SendClientMessage(playerid,TEAM_slytherin_COLOR, "Car is repaired.");
    }
    return 1;
}

That's more along the lines of what you were doing.
Ahh, Thanks... I see... :P