PDA

View Full Version : Problems


MariusAdv
01/03/2018, 02:04 PM
Code
if( PaintType[ killerid ] != 0 && PaintType[ playerid ] != 0 ) {
PKills[ killerid ] ++; PDeaths[ playerid ] ++;
SCMf( killerid, COLOR_CLIENT, "L-ai omorat pe %s cu un %s de la distanta de %0.2fm.", GetName( playerid ), weapName( reason ), GetDistanceBetweenPlayers( playerid, killerid ) );
SCMf( playerid, COLOR_CLIENT, "Ai fost omorat de %s cu un %s de la distande de %0.2fm.", GetName( killerid ), weapName( reason ), GetDistanceBetweenPlayers( playerid, killerid ) );
if( PaintType[ killerid ] == 3 && PaintType[ playerid ] == 3 ) {
if( GetPaintLevel( playerid ) == 8 ) {
Line 555 foreach( new x : Player ) {
if( PaintType[ x ] == PaintType[ killerid ] ) {
for( new i = 0; i < 5; i++ ) SendDeathMessageToPlayer( x, 1001, 1001, 200 );
SendPaintballMessage( PaintType[ x ] - 1, COLOR_YELLOW, "* %s a castigat runda deoarece a omorat pe %s cu un cutit.", GetName( killerid ), GetName( playerid ) );
SpawnPlayer( x );
PKills[ x ] = 0; PDeaths[ x ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -2; PaintballWinner[ PaintType[ killerid ] - 1 ] = x; PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = 0;
}
}
} else GiveSkillWeapon( killerid );
if( PaintTime[ PaintType[ killerid ] - 1 ] == -2 ) {
if( PaintTimer[ PaintType[ killerid ] - 1 ] != 0 ) KillTimer( PaintTimer[ PaintType[ killerid ] - 1 ] ), PaintTimer[ PaintType[ killerid ] - 1 ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -1; PaintText[ PaintType[ killerid ] - 1 ] = 60; PaintVote[ PaintType[ killerid ] - 1 ] = 1;
PaintTimer[ PaintType[ killerid ] - 1 ] = SetTimerEx( "CalculateVote", 60000, false, "d", PaintType[ killerid ] - 1 );
SendPaintballMessage( PaintType[ killerid ], COLOR_YELLOW, "Runda va incepe peste un minute. Pentru a vote o mapa, folositi comanda [/votemap]." );
}
}
foreach( new x : Player ) { if( PaintType[ x ] == PaintType[ playerid ] ) SendDeathMessageToPlayer( x, killerid, playerid, reason ); }
if( PKills[ killerid ] - PDeaths[ killerid ] > PaintballWinnerScore[ PaintType[ killerid ] - 1 ] ) PaintballWinner[ PaintType[ killerid ] - 1 ] = killerid, PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = PlayerPaintballScore[ killerid ];

Error's
warning 219: local variable "x" shadows a variable at a preceding level (Line 555)
error 017: undefined symbol "Player" (Line 555)
error 017: undefined symbol "Player" (Line 555)
warning 215: expression has no effect (Line 555)
error 001: expected token: ";", but found "]" (Line 555)
fatal error 107: too many error messages on one line (Line 555)

jasperschellekens
01/03/2018, 02:15 PM
Code
if( PaintType[ killerid ] != 0 && PaintType[ playerid ] != 0 ) {
PKills[ killerid ] ++; PDeaths[ playerid ] ++;
SCMf( killerid, COLOR_CLIENT, "L-ai omorat pe %s cu un %s de la distanta de %0.2fm.", GetName( playerid ), weapName( reason ), GetDistanceBetweenPlayers( playerid, killerid ) );
SCMf( playerid, COLOR_CLIENT, "Ai fost omorat de %s cu un %s de la distande de %0.2fm.", GetName( killerid ), weapName( reason ), GetDistanceBetweenPlayers( playerid, killerid ) );
if( PaintType[ killerid ] == 3 && PaintType[ playerid ] == 3 ) {
if( GetPaintLevel( playerid ) == 8 ) {
Line 555 foreach( new x : Player ) {
if( PaintType[ x ] == PaintType[ killerid ] ) {
for( new i = 0; i < 5; i++ ) SendDeathMessageToPlayer( x, 1001, 1001, 200 );
SendPaintballMessage( PaintType[ x ] - 1, COLOR_YELLOW, "* %s a castigat runda deoarece a omorat pe %s cu un cutit.", GetName( killerid ), GetName( playerid ) );
SpawnPlayer( x );
PKills[ x ] = 0; PDeaths[ x ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -2; PaintballWinner[ PaintType[ killerid ] - 1 ] = x; PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = 0;
}
}
} else GiveSkillWeapon( killerid );
if( PaintTime[ PaintType[ killerid ] - 1 ] == -2 ) {
if( PaintTimer[ PaintType[ killerid ] - 1 ] != 0 ) KillTimer( PaintTimer[ PaintType[ killerid ] - 1 ] ), PaintTimer[ PaintType[ killerid ] - 1 ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -1; PaintText[ PaintType[ killerid ] - 1 ] = 60; PaintVote[ PaintType[ killerid ] - 1 ] = 1;
PaintTimer[ PaintType[ killerid ] - 1 ] = SetTimerEx( "CalculateVote", 60000, false, "d", PaintType[ killerid ] - 1 );
SendPaintballMessage( PaintType[ killerid ], COLOR_YELLOW, "Runda va incepe peste un minute. Pentru a vote o mapa, folositi comanda [/votemap]." );
}
}
foreach( new x : Player ) { if( PaintType[ x ] == PaintType[ playerid ] ) SendDeathMessageToPlayer( x, killerid, playerid, reason ); }
if( PKills[ killerid ] - PDeaths[ killerid ] > PaintballWinnerScore[ PaintType[ killerid ] - 1 ] ) PaintballWinner[ PaintType[ killerid ] - 1 ] = killerid, PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = PlayerPaintballScore[ killerid ];

Error's
warning 219: local variable "x" shadows a variable at a preceding level (Line 555)
error 017: undefined symbol "Player" (Line 555)
error 017: undefined symbol "Player" (Line 555)
warning 215: expression has no effect (Line 555)
error 001: expected token: ";", but found "]" (Line 555)
fatal error 107: too many error messages on one line (Line 555)
Change
foreach( new x : Player )
to
foreach(Player,x)

MariusAdv
01/03/2018, 02:17 PM
Nope, same error's.

jasperschellekens
01/03/2018, 02:18 PM
Nope, same error's.

replace x with i, its shadowing x which means x already exists in the script or somewhere global.
u also have :
#include <foreach>
?

MariusAdv
01/03/2018, 02:21 PM
I have #include <foreach>

rolex
01/03/2018, 02:27 PM
try

if( PaintType[ killerid ] != 0 && PaintType[ playerid ] != 0 ) {
PKills[ killerid ] ++; PDeaths[ playerid ] ++;
SCMf( killerid, COLOR_CLIENT, "L-ai omorat pe %s cu un %s de la distanta de %0.2fm.", GetName( playerid ), weapName( reason ), GetDistanceBetweenPlayers( playerid, killerid ) );
SCMf( playerid, COLOR_CLIENT, "Ai fost omorat de %s cu un %s de la distande de %0.2fm.", GetName( killerid ), weapName( reason ), GetDistanceBetweenPlayers( playerid, killerid ) );
if( PaintType[ killerid ] == 3 && PaintType[ playerid ] == 3 ) {
if( GetPaintLevel( playerid ) == 8 ) {
foreach( Player : j) {
if( PaintType[ j ] == PaintType[ killerid ] ) {
for( new i = 0; i < 5; i++ ) SendDeathMessageToPlayer( j, 1001, 1001, 200 );
SendPaintballMessage( PaintType[ j ] - 1, COLOR_YELLOW, "* %s a castigat runda deoarece a omorat pe %s cu un cutit.", GetName( killerid ), GetName( playerid ) );
SpawnPlayer( j );
PKills[ j ] = 0; PDeaths[ j ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -2; PaintballWinner[ PaintType[ killerid ] - 1 ] = j; PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = 0;
}
}
} else GiveSkillWeapon( killerid );
if( PaintTime[ PaintType[ killerid ] - 1 ] == -2 ) {
if( PaintTimer[ PaintType[ killerid ] - 1 ] != 0 ) KillTimer( PaintTimer[ PaintType[ killerid ] - 1 ] ), PaintTimer[ PaintType[ killerid ] - 1 ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -1; PaintText[ PaintType[ killerid ] - 1 ] = 60; PaintVote[ PaintType[ killerid ] - 1 ] = 1;
PaintTimer[ PaintType[ killerid ] - 1 ] = SetTimerEx( "CalculateVote", 60000, false, "d", PaintType[ killerid ] - 1 );
SendPaintballMessage( PaintType[ killerid ], COLOR_YELLOW, "Runda va incepe peste un minute. Pentru a vote o mapa, folositi comanda [/votemap]." );
}
}
foreach( Player : t ) { if( PaintType[ t ] == PaintType[ playerid ] ) SendDeathMessageToPlayer( t, killerid, playerid, reason ); }
if( PKills[ killerid ] - PDeaths[ killerid ] > PaintballWinnerScore[ PaintType[ killerid ] - 1 ] ) PaintballWinner[ PaintType[ killerid ] - 1 ] = killerid, PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = PlayerPaintballScore[ killerid ];

GRiMMREAPER
01/03/2018, 02:31 PM
Do you have any variable named x anywhere in the script? If so, change foreach(Player, x) to foreach(new xLoop : Player). Then, for every x that is inside of that loop, replace with xLoop.

foreach( new xLoop : Player) {
if( PaintType[ j ] == PaintType[ killerid ] ) {
for( new i = 0; i < 5; i++ ) SendDeathMessageToPlayer( xLoop, 1001, 1001, 200 );
SendPaintballMessage( PaintType[ xLoop ] - 1, COLOR_YELLOW, "* %s a castigat runda deoarece a omorat pe %s cu un cutit.", GetName( killerid ), GetName( playerid ) );
SpawnPlayer( xLoop );
PKills[ xLoop ] = 0; PDeaths[ xLoop ] = 0;
PaintTime[ PaintType[ killerid ] - 1 ] = -2; PaintballWinner[ PaintType[ killerid ] - 1 ] = xLoop; PaintballWinnerScore[ PaintType[ killerid ] - 1 ] = 0;
} else GiveSkillWeapon( killerid );