Using same command for another gate
#1

Hey guys,

Im making a toll-system that opens the gate with ''/toll'' and closing automaticly after severeal sec. No I have 2 gates (for both sides of the road) and I want to open both tolls with ''/toll'' the commands are checking if player is in range, but I can only use 1 gate....
Here the piece of my script for the command:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/toll", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 1806.19921875, 926.7998046875, 8.3000001907349))
        {
            if(GetPlayerWantedLevel(playerid) > 3)
            {
                new tmp[64];
                format(tmp, sizeof(tmp), "Your current wanted level is: %i you cannot pass the toll! Find another way!", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, 0xFF0000FF, tmp);
            }
            else
            {
                SetTimerEx("CloseGate", 3000, false, "i", playerid);
                SetPVarInt(playerid, "PVarMoney", -50);
               
                MoveObject(Gate, 1806.1999511719, 926.79998779297, 8.3000001907349, 3.0, 0.0, 359.25, 0.0);
                SendClientMessage(playerid, 0x006EFFFF, "You paid toll, you are ready to go!");
            }
        }
        return 1;
    }
    return 0;
}
Hope you know what I can do..
Mayebe I have to do:
else if PlayeInRangeOfPoitnt (the other gate)
opens that gate ?
Reply
#2

Simple enough, right?:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/toll", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 1806.19921875, 926.7998046875, 8.3000001907349))
        {
            if(GetPlayerWantedLevel(playerid) > 3)
            {
                new tmp[64];
                format(tmp, sizeof(tmp), "Your current wanted level is: %i you cannot pass the toll! Find another way!", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, 0xFF0000FF, tmp);
            }
            else
            {
                SetTimerEx("CloseGate", 3000, false, "i", playerid);
                SetPVarInt(playerid, "PVarMoney", -50);

                MoveObject(Gate, 1806.1999511719, 926.79998779297, 8.3000001907349, 3.0, 0.0, 359.25, 0.0);
                SendClientMessage(playerid, 0x006EFFFF, "You paid toll, you are ready to go!");
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 10.0, OtherPosX, OtherPosY, OtherPosZ))
        {
            if(GetPlayerWantedLevel(playerid) > 3)
            {
                new tmp[64];
                format(tmp, sizeof(tmp), "Your current wanted level is: %i you cannot pass the toll! Find another way!", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, 0xFF0000FF, tmp);
            }
            else
            {
                SetTimerEx("CloseGate", 3000, false, "i", playerid);
                SetPVarInt(playerid, "PVarMoney", -50);

                MoveObject(Gate, OtherOtherPosX, OtherOtherPosY, OtherOtherPosZ, 3.0, 0.0, 359.25, 0.0);
                SendClientMessage(playerid, 0x006EFFFF, "You paid toll, you are ready to go!");
            }
        }
        return 1;
    }
    return 0;
}
Reply
#3

Yeah okey, thanks!
Reply
#4

yes use else if(IsPlayerInRangeOfPoint ....
and detect which place near he is and open the nearest door.

Код:
This forum requires that you wait 120 seconds between posts. Please try again in 46 seconds.
Edit: Too late
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)