SA-MP Forums Archive
/repair - 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 (/showthread.php?tid=108720)



/repair - Puzi - 15.11.2009

Hello, would it be possible to make in a checkpoint if someone enters with a vehicle, a message comes up that if you want to repair type /repair and when you're done, it says you're done and you can drive off. Is it possible?

Thanks and Regards
Puzi


Re: /repair - Cedimedi - 15.11.2009

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  {
   SendClientMessage(playerid, COLOR_YELLOW, "Wait here, your car will get repaired.");
   SetTimer("repair",1000,false)
   }
  return 1;
}
pawn Код:
forward repair();
public repair()
{
    RepairVehicle(GetPlayerVehicleID(playerid));
}
Then a timer... that repair vehicle then. And ya, in the script above maybe IsPlayerInAnyVehicle. Can't script all im a bit busy.


Edit: Made it for you... I didn't tested it, maybe some indentationerrors lol


Re: /repair - Puzi - 15.11.2009

Thanks for that but i aint 100% sure how to make RepairVehicle in the checkpoint, can anyone help? I'll make the timer myself


Re: /repair - Cedimedi - 15.11.2009

Updated my post...


Re: /repair - Puzi - 15.11.2009

Код:
C:\Users\PUZI\Desktop\Racing\gamemodes\sampracing.pwn(455) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I had a Indentation warning but I fixed that

And I am also unsure on how to make the repair command, will look on SA-MP Wiki...


Re: /repair - Virtual1ty - 15.11.2009

Quote:
Originally Posted by Puzi
Код:
C:\Users\PUZI\Desktop\Racing\gamemodes\sampracing.pwn(455) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I had a Indentation warning but I fixed that
its not an Indentation warning! and yes cedimedi has forgot "playerid" in his ; public repair() function


Re: /repair - Puzi - 15.11.2009

I said I fixed an Indentation warning you nub. If you cant help, why you post?

Код:
  if (!strcmp("/repair", cmdtext))
  {
    if(IsPlayerInAnyVehicle(playerid) & (IsPlayerInCheckpoint(playerid))
)
    {
      RepairVehicle(GetPlayerVehicleID(playerid));
      SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** Your vehicle has been successfully repaired! You may leave the Pitstop!");
    }
    else SendClientMessage(playerid, COLOR_YELLOW, "*** You are not in a vehicle!");
    return 1;
  }
}
Would that be a correct /repair command?


Re: /repair - Virtual1ty - 15.11.2009

pawn Код:
if(strcmp(cmdtext, "/repair", true) == 0)
  {
    if(IsPlayerInAnyVehicle(playerid) & (IsPlayerInCheckpoint(playerid)))
    {
      RepairVehicle(GetPlayerVehicleID(playerid));
      SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** Your vehicle has been successfully repaired! You may leave the Pitstop!");
    }
    else SendClientMessage(playerid, COLOR_YELLOW, "*** You are not in a vehicle!");
        return 1;
  }



Re: /repair - Puzi - 15.11.2009

Well, works, but I get the Pawn Library Compiler Error before compiling


Re: /repair - miokie - 15.11.2009

pawn Код:
if(strcmp(cmdtext, "/repair", true) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*** You are not in a vehicle!");
        if(!IsPlayerInCheckpoint(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*** You are not in the checkpoint!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** Your vehicle has been successfully repaired! You may leave the Pitstop!");
        return 1;
    }