help - Simple checkpoint for repair
#1

Hi. Can you please help me make a simple checkpoint for repair vehicle?

When a player with a vehicle land on a checkpoint. the vehicle will freeze and starts repairing. I was ******ing if there are some tuts but there are none.

Thanks!
Reply
#2

OnPlayerEnterCheckpoint - TogglePlayerControllable - SetVehicleHealth - GivePlayerMoney - done
Reply
#3

Very well explained. Hope someone help me with a simple coding as well.
Reply
#4

Код:
if(strcmp(cmdtext, "/repair", true)==0)
{
  if(IsPlayerInCheckpoint(playerid))
  {
    if(IsPlayerInAnyVehicle(playerid))
    {
        Freeze(vehicleid);
        SetTimerEx("Unfreeze", 5000, false, "i", playerid
    }
    else
    {
      SendClientMessage(playerid, red, "Error: You need to be in a vehicle to repair it!");
    }
  }
  else
  {
    SendClientMessage(playerid, red, "Error: You are not in the checkpoint!");
  }
  return 1;
}
Reply
#5

Quote:
Originally Posted by GrandParadise
Посмотреть сообщение
Код:
if(strcmp(cmdtext, "/repair", true)==0)
{
  if(IsPlayerInCheckpoint(playerid))
  {
    if(IsPlayerInAnyVehicle(playerid))
    {
      RepairVehicle(GetPlayerVehicleID(playerid));
    }
    else
    {
      SendClientMessage(playerid, red, "Error: You need to be in a vehicle to repair it!");
    }
  }
  else
  {
    SendClientMessage(playerid, red, "Error: You are not in the checkpoint!");
  }
  return 1;
}
Wow thanks +rep, and how about if I will make a message that will show only when he enter the repair checkpoint?

Let say I landed on the checkpoint and a message will appear "Press Alt Key to Repair your vehicle" and which is better textdraw or gametextforplay?

EDIT: also the repair will take 5 seconds
Reply
#6

I'd rather use textdraw as it looks more professional.
Reply
#7

Yeah right! Lol anyway the script you posted. Is the freeze forever? Can you add a timer after 5 seconds freeze then after the 6 seconds it will unfrozen.
Reply
#8

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerCheckpoint(playerid, 0, 0, 0, 3.0); //fill the things...
    return 1;
}
 
public OnPlayerEnterCheckpoint(playerid)
{
    TogglePlayerControllable(playerid,0);
    SetTimerEx("srepair",10000,0,"i",playerid);
    return 1;
}

forward srepair(playerid);
public srepair(playerid)
{
   TogglePlayerControllable(playerid,1);
   RepairVehicle(GetPlayerVehicleID(playerid));
   GameTextForPlayer(playerid,"~n~~g~Vehicle ~r~Repaired",3000,3);
   return 1;
}
Reply
#9

Thanks blackbomb you just bombed my world! I also like to ask something.

Do you think it's possible if I enter the repair checkpoint, my damaged vehicle will start repairing every seconds? Let say my vehicle hp is 500 (half of 1000 max hp) when I enter the checkpoint it will raise by 30hp each seconds? Without freezing the vehicle? then when I leave the repair checkpoint it will stop repairing.
Reply
#10

Hi anyone?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)