/repair
#1

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
Reply
#2

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
Reply
#3

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

Updated my post...
Reply
#5

Код:
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...
Reply
#6

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
Reply
#7

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?
Reply
#8

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;
  }
Reply
#9

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

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;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)