Checkpoint Timer -
jesuschristlordandsavior - 06.02.2010
Ok this may be a hard question to ask on the forum and just tell me if something that can't be answered here.
Ok I have a checkpoint mapped. How would I make it so when I enter that checkpoint another checkpoint I map shows up and a timer starts and I have X amount of time to get to the other checkpoint?
E.g. I enter checkpoint 1 and checkpoint 2 shows up on radar and timer shows up with 150 seconds time to get to checkpoint 2?
Re: Checkpoint Timer -
mansonh - 07.02.2010
Heres a really simple peice of code
pawn Код:
//put this at the top
new player cprun = 0, cprunTimer;
//put this wherever you want to start your checkpoint task
SetPlayerCheckpoint(playerid, x,y,z,size);
public OnPlayerEnterCheckpoint(playerid)
{
if(cprun==0)
{
DisablePlayerCheckpoint(playerid);
//this is the second checkpoint
SetPlayerCheckpoint(playerid, x,y,z,size);
//set timer for 20 seconds
cprunTimer = SetTimerEx("Failcprun", 20000, 0, "d", playerid);
cprun = 1;
}else if(cprun==1)
{
KillTimer(cprunTimer);
SendClientMessage(playerid, 0xAAAAAAAA, "you finished the Checkpoint Run");
}
}
public Failcprun(playerid)
{
SendClientMessage(playerid, 0xAAAAAAAA, "you failed the Checkpoint Run");
DisablePlayerCheckpoint(playerid);
}
Re: Checkpoint Timer -
jesuschristlordandsavior - 07.02.2010
I tried that code and all I did was edit the coordinates and I get these errors:
C:\Users\*********\scripts\Gamemodes\*********.pwn (44
: warning 202: number of arguments does not match definition
C:\Users\*********\scripts\Gamemodes\*********.pwn (464) : error 001: expected token: ";", but found "-identifier-"
C:\Users\*********\scripts\Gamemodes\*********.pwn (467) : error 021: symbol already defined: "SetPlayerCheckpoint"
C:\Users\*********\scripts\Gamemodes\*********.pwn (471) : error 017: undefined symbol "cprun"
C:\Users\*********\scripts\Gamemodes\*********.pwn (477) : error 017: undefined symbol "cprunTimer"
C:\Users\*********\scripts\Gamemodes\*********.pwn (47
: error 017: undefined symbol "cprun"
C:\Users\*********\scripts\Gamemodes\*********.pwn (47
: warning 215: expression has no effect
C:\Users\*********\scripts\Gamemodes\*********.pwn (479) : error 017: undefined symbol "cprun"
C:\Users\*********\scripts\Gamemodes\*********.pwn (481) : error 017: undefined symbol "cprunTimer"
C:\Users\*********\scripts\Gamemodes\*********.pwn (486) : warning 235: public function lacks forward declaration (symbol "Failcprun")
C:\Users\Johnny\Desktop\scripts\Gamemodes\trucking .pwn(493) : warning 203: symbol is never used: "player"
How would I fix that?
Re: Checkpoint Timer -
jesuschristlordandsavior - 07.02.2010
Turns out I forgot to define cprun and cpruntimer but even after defining them I still get:
Код:
.pwn(470) : error 021: symbol already defined: "SetPlayerCheckpoint"
.pwn(474) : error 029: invalid expression, assumed zero
.pwn(474) : warning 215: expression has no effect
.pwn(474) : error 001: expected token: ";", but found ")"
.pwn(474) : error 029: invalid expression, assumed zero
.pwn(474) : fatal error 107: too many error messages on one line
Re: Checkpoint Timer -
mansonh - 07.02.2010
//put this wherever you want to start your checkpoint task
SetPlayerCheckpoint(playerid, x,y,z,size);
You can't just put that anywhere, it has to go inside another function.
What is line 474?
Re: Checkpoint Timer -
jesuschristlordandsavior - 07.02.2010
Line 474 = "if(cprun==0)"
Re: Checkpoint Timer -
mansonh - 08.02.2010
That doesn't make sense. Post the code where you have put this.
Oh and make sure cprun is a global variable.
Re: Checkpoint Timer -
[Bm]rap45 - 08.02.2010
Quote:
Originally Posted by mansonh
SetPlayerCheckpoint(playerid, x,y,z,size);
|
I believe you need to put that on
pawn Код:
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
Re: Checkpoint Timer -
mansonh - 08.02.2010
He can't put it on gamemode init, because there is no playerid in gamemodeinit.
He could put it in playerspawn or if he had a command like /cpgame.
But the error he has now is something odd, will have to see how he is using the code to fix it.
Re: Checkpoint Timer -
[Bm]rap45 - 08.02.2010
ohh well yea ur right :/ jesussave... show us the whole code and point out the lines with the problems.