forward isPlayerInArea()
SetTimer("isPlayerInArea",1000, 1);
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if (X <= ?maxX? && X >= ?minX? && Y <= ?maxY? && Y >= ?minY?) /* This line is the important one!. Here, is where you change those numbers, by the ones you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z doesn't matter*/
if (strcmp("/pos", cmdtext, true, 10) == 0) { new string1[256]; new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); format(string1,sizeof(string1),"Position = X: %.0f , Y: %.0f , Z: %.0f",X,Y,Z); SendClientMessage(playerid,0x33FF33AA,string1); return 1; }
forward isPlayerInArea()
public OnGameModeInIt() SetTimer("isPlayerInArea",1000, 1);
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if (X <= ?maxX? && X >= ?minX? && Y <= ?maxY? && Y >= ?minY?) /* This line is the important one!. Here, is where you change those numbers, by the ones you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z doesn't matter*/
CreateObject(975, 214.45, 1875.53, 13.80, 0.00, 0.00, 0.00); // Main gate closed
new maingate; // change its name if you like.
maingate = CreateObject(975, 214.45, 1875.53, 13.80, 0.00, 0.00, 0.00); // Main gate closed
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if (X <= ?maxX? && X >= ?minX? && Y <= ?maxY? && Y >= ?minY?) /* This line is the important one!. Here, is where you change those numbers, by the ones you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z doesn't matter*/ { MoveObject(maingate, 222.00, 1875.53, 13.80, 1); // MoveObject(ObjectID, X, Y, Z, speed); - Object id is the "New" }
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if (X <= ?maxX? && X >= ?minX? && Y <= ?maxY? && Y >= ?minY?) /* This line is the important one!. Here, is where you change those numbers, by the ones you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z doesn't matter*/ { MoveObject(maingate, 222.00, 1875.53, 13.80, 1); // MoveObject(ObjectID, X, Y, Z, speed); - Object id is the "New" } else // else means that if nothing is in it, perform this action: { MoveObject(maingate, 214.45, 1875.53, 13.80, 1); // This will close the gate } } return 1; }
if( GetPlayerTeam(i) == TEAM_NAME )
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; //We use this to store player position for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i" { GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously if (X <= ?maxX? && X >= ?minX? && Y <= ?maxY? && Y >= ?minY?) /* This line is the important one!. Here, is where you change those numbers, by the ones you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z doesn't matter*/ { if( GetPlayerTeam(i) == TEAM_DEFENSE) // tells the script to open the gate to Team Defense only. { MoveObject(maingate, 222.00, 1875.53, 13.80, 1); // MoveObject(ObjectID, X, Y, Z, speed); - Object id is the "New" } else // else means that if nothing is in it, perform this action: { MoveObject(maingate, 214.45, 1875.53, 13.80, 1); // This will close the gate } } } return 1; }
C:\SERVER SAMP\gamemodes\lvdmYossI.pwn(1385) : error 029: invalid expression, assumed zero C:\SERVER SAMP\gamemodes\lvdmYossI.pwn(1385) : error 017: undefined symbol "maxX" C:\SERVER SAMP\gamemodes\lvdmYossI.pwn(1385) : error 017: undefined symbol "minX" C:\SERVER SAMP\gamemodes\lvdmYossI.pwn(1385) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Originally Posted by Farly
Hmm wont this just keep the gate closed all of the time because someone in the server is not going to be in that area, so the gate will close.
|
if((X <= 1541.5036 && X >= 1530.1136 && Y <= -1436.6630 && Y >= -1464.1524) || (X <= 1561.2152 && X >= 1504.2138 && Y <= -1430.9941 && Y >= -1450.5169)) { { MoveObject(GPRHQTor,1534.51,-1451.48,20,3); } } else if((!(X <= 1541.5036 && X >= 1530.1136 && Y <= -1436.6630 && Y >= -1464.1524)) || (!(X <= 1561.2152 && X >= 1504.2138 && Y <= -1430.9941 && Y >= -1450.5169))) { MoveObject(GPRHQTor,1534.51,-1451.48,14.7531,3); }
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= ?maxX? && X >= ?minX? && Y <= ?maxY? && Y >= ?minY?)