...Timed gate? -
FrazZ - 07.04.2009
an someone add a 5 second timer to this?
Код:
if(strcmp(cmd, "/openogate", true) == 0) { // Edit the /eup to your elevator command.
if(GetPlayerMoney(playerid) > 250)
GivePlayerMoney(playerid,-250);
MoveObject(frazzgate,1534.98,-1451.48,9.70,2.00); // Put your cords in here
SendClientMessage(playerid, COLOR_RED, "You have 5 seconds to get in."); // You dont alwas have to put this in, delete if wanted.
return 1;
}
Its a gate.
Re: ...Timed gate? -
Weirdosport - 07.04.2009
I assume you want a timer to close it again?
Top of Script with new's and things...:
pawn Код:
forward gateclosetimer();
Inside your timer script:
pawn Код:
SetTimer("gateclosetimer", 5000, false);
Create this at the bottom of your script:
pawn Код:
gateclosetimer()
{
MoveObject(Object, X, Y, Z, 2.00);
}
NOTE: You must put the X, Y and Z in yourself, they're the co-ordinates the gate starts at!
Re: ...Timed gate? -
FrazZ - 07.04.2009
I put it at the bottom of the script:
Код:
C:\Users\FrazzFilms\Desktop\Server\gamemodes\penls.pwn(18298) : warning 203: symbol is never used: "gateclosetimer"
and I put in this at forwards:
Код:
forward gateclosetimer();
and then I put the timer in the code:
Код:
if(strcmp(cmd, "/openogate", true) == 0) { // Edit the /eup to your elevator command.
if(GetPlayerMoney(playerid) > 250)
GivePlayerMoney(playerid,-250);
MoveObject(frazzgate,1534.98,-1451.48,9.70,2.00); // Put your cords in here
SendClientMessage(playerid, COLOR_RED, "You have 5 seconds to get in.");
SetTimer("gateclosetimer", 5000, false);
return 1;
}
then I get:
Код:
C:\Users\FrazzFilms\Desktop\Server\gamemodes\penls.pwn(18298) : warning 203: symbol is never used: "gateclosetimer"
Re: ...Timed gate? -
Weirdosport - 07.04.2009
The forward needs to be at the top, probably above the OnGameMode/FilterscriptInit
The Function ( gateclosetimer() { } ) bit needs to be at the bottom.
By the way, there's a bracket missing in most of the Pawn quotes you've made.
Sorry think I made a mistake, it's mean to be:
pawn Код:
public gateclosetimer()
{
//blah
}
Re: ...Timed gate? -
FrazZ - 07.04.2009
C:\Users\FrazzFilms\Desktop\Server\gamemodes\penls .pwn(18294) : warning 217: loose indentation
C:\Users\FrazzFilms\Desktop\Server\gamemodes\penls .pwn(18294) : error 029: invalid expression, assumed zero
C:\Users\FrazzFilms\Desktop\Server\gamemodes\penls .pwn(1829
: error 017: undefined symbol "Object"
At the very bottom:
Код:
public gateclosetimer();
}
gateclosetimer()
{
MoveObject(Object, 1534.98,-1451.48,15.00, 2.00);
}
At the very top: (Around the Forwards)
Код:
forward gateclosetimer();
In the gate code:
Код:
if(strcmp(cmd, "/openogate", true) == 0) { // Edit the /eup to your elevator command.
if(GetPlayerMoney(playerid) > 250)
GivePlayerMoney(playerid,-250);
MoveObject(frazzgate,1534.98,-1451.48,9.70,2.00); // Put your cords in here
SendClientMessage(playerid, COLOR_RED, "You have 5 seconds to get in.");
SetTimer("gateclosetimer", 5000, false);
return 1;
}
Re: ...Timed gate? -
Weirdosport - 07.04.2009
You've mis typed/copied several of the pieces of code... try these:
pawn Код:
public gateclosetimer();
{
MoveObject(frazzgate, 1534.98,-1451.48,15.00, 2.00);
}
pawn Код:
if(strcmp(cmd, "/opengate", true) == 0)
{
if(GetPlayerMoney(playerid) > 250)
{
GivePlayerMoney(playerid,-250);
MoveObject(frazzgate,1534.98,-1451.48,9.70,2.00); // Put your cords in here
SendClientMessage(playerid, 0xFF0000AA, "You have 5 seconds to get in.");
SetTimer("gateclosetimer", 5000, false);
}
return 1;
}
Re: ...Timed gate? -
FrazZ - 07.04.2009
Код:
C:\Users\FrazzFilms\Desktop\Server\gamemodes\penls.pwn(18298) : error 055: start of function body without function header
I decided I dont need people to pay anymore, its admin only:
Код:
if(strcmp(cmd, "/openogate", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 1338)
{
GivePlayerMoney(playerid,-250);
MoveObject(frazzgate,1534.98,-1451.48,9.70,2.00); // Put your cords in here
SendClientMessage(playerid, 0xFF0000AA, "You have 5 seconds to get in.");
SetTimer("gateclosetimer", 5000, false);
}
return 1;
}
Re: ...Timed gate? -
Weirdosport - 07.04.2009
I don't know what you've done, you keep taking bits of my code and changing them, that's why they're not working. I put the same ones in pawno, compiled and had no problems.
Re: ...Timed gate? -
FrazZ - 07.04.2009
Its ok now, I realised I wasnt copying one of the brackets when I did cop/paste... THANKS A BUNCH
Re: ...Timed gate? -
Weirdosport - 07.04.2009
Another problem solved =)