problem with wiki tutorial
#1

i get errors if i put this codes in my script and in the right place what is saying this wiki tutorial ..can i know why ?



Quote:

Additionally, you need to have coordinates of 2 locations - closed and open gate (X, Y, Z) and the closed gate must be created.

// this will go above main(), as this is a global variable
new c_gate;

// this will go under OnGameModeInit or OnFilterScriptInit
c_gate = CreateObject(object_ID, closed_X, closed_Y, closed_Z, closed_rad_X, closed_rad_Y, closed_rad_Z);

And for third, you need to have the global variable for players:

// this will go above main()
new OpenGate[MAX_PLAYERS];


[edit]
Making automatic gates

Firstly, we will set a timer from OnGameModeInit() which will call after your selected time (mine has checked after 500ms, always). Feel free to change the 500ms to some other amount, but keep in mind that 1000ms equals one second. Learn more about the SetTimer function.

SetTimer("CheckGate", 500, true);

Now, we'll move on to the timer, which we'll forward properly.

// this will go above main()
forward CheckGate();

public CheckGate()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z) && OpenGate[i] == 0)
{
MoveObject(c_gate, open_X, open_Y, open_Z);
OpenGate[i] = 1;
}
else if(!PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z) && OpenGate[i] == 1)
{
MoveObject(c_gate, closed_X, closed_Y, closed_Z);
OpenGate[i] = 0;
}
}
}

Reply
#2

Show us the errors please.
Reply
#3

C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(363 ) : warning 203: symbol is never used: "c_gate"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.





C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(46) : error 017: undefined symbol "c_gate"
C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(46) : error 017: undefined symbol "object_ID"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.







C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(363 ) : warning 203: symbol is never used: "OpenGate"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.




then where to put this code?

SetTimer("CheckGate", 500, true);






C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(24) : error 021: symbol already defined: "SetTimer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.




and this:
forward CheckGate();



and this:


public CheckGate()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z) && OpenGate[i] == 0)
{
MoveObject(c_gate, open_X, open_Y, open_Z);
OpenGate[i] = 1;
}
else if(!PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z) && OpenGate[i] == 1)
{
MoveObject(c_gate, closed_X, closed_Y, closed_Z);
OpenGate[i] = 0;
}
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)