Please i need help fast!! -
Pasa - 25.07.2011
code:
PHP код:
if(strcmp(cmd, "/ruta1", true) == 0)
{
new check = CreateDynamicCP(1246.7488,-1849.2052,12.9554,5,0,0,playerid,300.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
DestroyDynamicCP(check);
new check1 = CreateDynamicCP(994.6367,-1568.6714,13.1099,5,0,0,playerid,300.0);
return 1;
}
When i compile:
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(4 6) : warning 204: symbol is assigned a value that is never used: "check"
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(3 9) : warning 203: symbol is never used: "r1ch1"
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(1 27) : warning 203: symbol is never used: "playerid"
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(5 6
: error 017: undefined symbol "check"
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(5 70) : warning 204: symbol is assigned a value that is never used: "check1"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
why are there this errors
Re: Please i need help fast!! -
dowster - 25.07.2011
your creating the variable check and check one inside the functions so they are discarded after the function finishes its work, remove the new from before check and check1, then above main put new check, check1;
**This forum requires that you wait 120 seconds between posts. Please try again in 36 seconds.
Re: Please i need help fast!! -
Pasa - 25.07.2011
When i do that then when i compile there are this erors
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(5 70) : error 017: undefined symbol "check"
C:\Documents and Settings\Adnan\Desktop\server\gamemodes\bare.pwn(5 72) : error 017: undefined symbol "check1"
line 570 DestroyDynamicCP(check);
line 572 check1 = CreateDynamicCP(994.6367,-1568.6714,13.1099,5,0,0,playerid,300.0);
why is this?
Re: Please i need help fast!! -
dowster - 25.07.2011
hmm... that is odd, try putting the "new check, check1;" at the very top, without quotes of course
Re: Please i need help fast!! -
iPLEOMAX - 25.07.2011
pawn Код:
// On top of your script:
new Check[MAX_PLAYERS];
// OnPlayerCommandText:
if(strcmp(cmd, "/ruta1", true) == 0)
{
Check[playerid] = CreateDynamicCP(1246.7488,-1849.2052,12.9554,5,0,0,playerid,300.0);
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
DestroyDynamicCP(Check[playerid]);
Check[playerid] = CreateDynamicCP(994.6367,-1568.6714,13.1099,5,0,0,playerid,300.0);
return true;
}
This way, It's possible for each player of the server to have their OWN Checkpoints or else, it will create problems.
Tip: When you create a new var; inside a function, you can use it ONLY for that particular function.
But if you create a Global Variable (on top of script) you can use that for every possible functions.
Re: Please i need help fast!! -
Pasa - 25.07.2011
iPLEOMAX thank you !