What's wrong with this? -
rangerxxll - 02.03.2012
pawn Code:
CMD:gate(playerid, params[])
{
if(GateClosed)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
{
GateClosed = false;
MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.00000000,0.00000000,88.00000000);
return 1;
}
}
else{
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
{
GateClosed = true;
MoveObject(Gate,89.19999695,2501.50000000,17.89999962, 3.0, 00000000,0.00000000,88.00000000);
return 1;
}
}
}
if(GateClosed1){
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = false;
MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
return 1;
}
else{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038)){
GateClosed1 = true;
MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
return 1;
}
}
return 1;
}
EDIT: I messed with the code a bit, and now I only got this Error.
Code:
C:\Users\Luke\Desktop\Scripting\gamemodes\urban.pwn(822) : error 030: compound statement not closed at the end of file (started at line 769)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Line 769 is
Re: What's wrong with this? -
Jefff - 02.03.2012
U are using GateClosed not GateClosed1
Re: What's wrong with this? -
Walsh - 02.03.2012
On line
You are not giving the statement something to compare to.
In your case it should be
Re: What's wrong with this? -
ricardo178 - 03.03.2012
Your code is just a chaos.. I don't realize what each command is checking/doing at the moment. Tell what you want exactly, so i can re-build it...
Re: What's wrong with this? -
Walsh - 03.03.2012
Try this, this should work. I see you wanted to make one gate command compatible with all the gates on your server.
You could use a little bit of practice.
pawn Code:
CMD:gate(playerid, params[])
{
if(GateClosed == true)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
{
GateClosed = false;
MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.00000000,0.00000000,88.00000000);
return 1;
}
}
else
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
{
GateClosed = true;
MoveObject(Gate,89.19999695,2501.50000000,17.89999962, 3.0, 00000000,0.00000000,88.00000000);
return 1;
}
}
if(GateClosed1 == true)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = false;
MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
return 1;
}
}
else
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = true;
MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
return 1;
}
}
return 1;
}
Re: What's wrong with this? -
ricardo178 - 03.03.2012
pawn Code:
CMD:gate(playerid, params[])
{
if(GateClosed == true)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
{
GateClosed = false;
MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.00000000,0.00000000,88.00000000);
return 1;
}
}
else
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
{
GateClosed = true;
MoveObject(Gate,89.19999695,2501.50000000,17.89999962, 3.0, 00000000,0.00000000,88.00000000);
return 1;
}
}
if(GateClosed1 == true)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = false;
MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
return 1;
}
}
else
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = true;
MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
return 1;
}
}
return 1;
}
Re: What's wrong with this? -
rangerxxll - 03.03.2012
Sorry about the messy code, I'm still learning. I've edited my original one (Didn't copy and paste your guy's) and tried to make it more readable. How's this?
pawn Code:
CMD:gate(playerid, params[])
{
if (gTeam[playerid] == TEAM_TE)
{
if(GateClosed == true)
{ //RED TEAM MAP2
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695,2501.50000000,17.89999962))
{
GateClosed = false;
MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.0, 0.0, 88.00000000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "This is the Counter Terrorists gate!");
}
}
}
else
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695,2501.50000000,17.89999962))
{
GateClosed = true;
MoveObject(Gate, 89.19999695,2501.50000000,17.89999962, 3.0, 0.0, 0.0, 88.00000000);
return 1;
}
}
if (gTeam[playerid] == TEAM_CT) //BLUE TEAM MAP2
{
if(GateClosed1 == true)
{ //blue team map2
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = false;
MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "This is the Terrorists gate!");
}
}
}
else
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
{
GateClosed1 = true;
MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
return 1;
}
}
return 1;
}
EDIT: Oh, and it works.