[Help]Auto Gates
#1

Hello,
How can i make gates when someone open them....they will open and close after some time...

Heres what I have...

This Is For "/Opengate"
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10.0,1582.62548828,-1638.09887695,12.37568665))
            {
       SetObjectRot(pGate2, 0.00000000,0.00000000,268.00000000);
       MoveObject(pGate3, 1595.74658203,-1638.20373535,14.15229225, 2.500000);
       SendClientMessage(playerid, COLOR_BLUE," You opened the gates of the Police Department. They will close automatically after 7 secunds.");
       SetTimer("pGateak", 7000, 1);
     return 1;
            }
And this is what should this timer do.... But doesn't seems to work :S
pawn Код:
public pGateak()
{
    SetObjectRot(pGate2, 0.00000000,0.00000000,268.00000000);
    MoveObject(pGate3, 1595.74658203,-1638.20373535,14.15229225, 2.500000);
}
And if is possible send a message to the player that gates have been closed...?
Reply
#2

try to remove setobject rot
Reply
#3

Quote:
Originally Posted by Thebest96
Посмотреть сообщение
try to remove setobject rot
I tried that now...but still doesn't work :S
Reply
#4

pawn Код:
public pGateak()
{
    SetObjectRot(pGate2, 0.00000000,0.00000000,268.00000000);
    MoveObject(pGate3, 1595.74658203,-1638.20373535,14.15229225, 2.500000);
}
Is for closing the gate right? how come its the same Rotation as open gate? Ain't a wonder its not working lol
Reply
#5

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
pawn Код:
public pGateak()
{
    SetObjectRot(pGate2, 0.00000000,0.00000000,268.00000000);
    MoveObject(pGate3, 1595.74658203,-1638.20373535,14.15229225, 2.500000);
}
Is for closing the gate right? how come its the same Rotation as open gate? Ain't a wonder its not working lol
OMFG!!!
LMAO
Dude thanks I was trying to get that work for last half hour.....
Never knew there would be an mistake :S
Reply
#6

We all do mistakes every now and then
Reply
#7


And one more question..How can I send player message when gates are closed...? I can't do that with SendClientMessage(..... :S
Reply
#8

edit so it match this:

pawn Код:
// In the command:
SetTimerEx("pGateak", 7000, false, "%i", playerid)

// the function
public pGateak(playerid)
{
    SetObjectRot(pGate2, 0.00000000,0.00000000,268.00000000);
    MoveObject(pGate3, 1595.74658203,-1638.20373535,14.15229225, 2.500000);
    SendClientMessage(playerid, COLOR, "Gate closing");
}
This will only send The message to the player that opened the gate.

To send to all in range do this:
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
     if(IsPlayerConnected(i))
     {
          if(IsPlayerInRange(i, 7, 7, GATE_X, GATE_Y, GATE_Z)
          {
                SendClientMessage(playerid, COLOR, "Gate closing");
          }
     }
}
Put that in the timer
Reply
#9

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
edit so it match this:

pawn Код:
public pGateak(playerid)
{
    SetObjectRot(pGate2, 0.00000000,0.00000000,268.00000000);
    MoveObject(pGate3, 1595.74658203,-1638.20373535,14.15229225, 2.500000);
     SendClientMessage(playerid, COLOR, "Gate closing");
}
I tried that already and I get this error
Код:
C:\Users\CrTheVirus\Desktop\Samp Server\[SAMP 0.3] - Razer\gamemodes\razer.pwn(25654) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And my 25654 line is:
Код:
 
SendClientMessage(playerid, COLOR_BLUE, "Gate closing");
Reply
#10

Read my post once more please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)