What is the code for this?.
#1

I just added a derby minigame to my server but my server has an auto repair system which means everytime the health of the car drops too low it will automatically repair it. Which makes derby impossible to win. I want to make a code so that it won't repair the car only in derby and qderby which is another kind of derby. Oh and forgot to mention my server if you press 2 it will repair the car and flip it back to normal can i make it so this doesn't work in derby and qderby too?.
Reply
#2

The most easy way is to do this:
pawn Код:
enum pInfo
{
    bool:in_DERBY
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public WHERE_YOU_CODED_YOUR_AUTO_REPAIR_SYSTEM
{
       if(!PlayerInfo[playerid][in_DERBY]) // The player's not in a derby
       {
            SET TIMERS, YOUR CODE, ETC.
        }
        else // DO NOTHING.
}
Remember to set the bool to true and false when ever the player enters/leaves the derby. There are many other options, but the easiest is this!
Reply
#3

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
The most easy way is to do this:
pawn Код:
enum pInfo
{
    bool:in_DERBY
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public WHERE_YOU_CODED_YOUR_AUTO_REPAIR_SYSTEM
{
       if(!PlayerInfo[playerid][in_DERBY]) // The player's not in a derby
       {
            SET TIMERS, YOUR CODE, ETC.
        }
        else // DO NOTHING.
}
Remember to set the bool to true and false when ever the player enters/leaves the derby. There are many other options, but the easiest is this!
Can you give me the complete code?.
Reply
#4

on the top of the script :
pawn Код:
new derby[MAX_PLAYERS]
in the code you send him to derby :
pawn Код:
derby[playerid] = 1
in the code he press 2 to repair (propobly on player key state change )
pawn Код:
if(derby[playerid] == 1)
{
         SendClientMessage(playerid,COLOR_RED,"You are in derby , you cannot repair your car !");
}
on the code of your auto repair system : ( i suggest on player update )
pawn Код:
public OnPlayerUpdate
{
         if(IsPlayerInAnyVehicle(playerid)
         {
                  if(derby[playerid] != 1)
                  {
                           RepairVehicle(GetPlayerVehicleID(playerid));
                  }
         }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)