Script Help
#1

Hi all I have an GM and the GM have errors on this script:
Quote:

if ( ServerInfo[ ConnectMessages ] == 1 )
{
new str[ 256 ], pAKA[ 256 ];
pAKA = dini_Get( "ladmin/config/aka.txt", tmp3 );
if ( strlen( pAKA ) < 3 ) format( str, sizeof( str ),"*** {FFFF00}%s(%d) {ACACAC}has joined the server", PlayerName( playerid ), playerid );
else if ( !strcmp( pAKA, PlayerName( playerid ), true ) ) format( str, sizeof( str ),"*** {FFFF00}%s(%d) {ACACAC}has joined the server", PlayerName( playerid ), playerid );
else format( str, sizeof( str ),"*** {FFFF00}%s(%d) {ACACAC}has joined the server ( AKA: {FFFF00}%s{ACACAC} )", PlayerName( playerid ), playerid, pAKA );

for ( new i = 0; i < MAX_PLAYERS; i++ ) if ( IsPlayerConnected( i ) && playerid != i )
{
if ( PlayerInfo[ i ][ Level ] > 2 ) SendClientMessage( i, COLOR_GREY, str );
else
{
format( str, sizeof( str ),"*** {FFFF00}%s(%d) {ACACAC}has joined the server", PlayerName( playerid ), playerid );
SendClientMessage( i, COLOR_GREY, str );
}
}
}
if ( dUserINT( PlayerName2( playerid ) ).( "Banned" ) == 1 )
{
new str2[ 256 ];
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, -1, " " );
SendClientMessage( playerid, COLOR_GREY, "This name is {FFFF00}BANNED {ACACAC}from this server!" );
Kick( playerid );

format( str2, sizeof( str2 ),"*** {FFFF00}%s (ID:%d) {ACACAC}was auto kicked. Reason: {33CCFF}Name banned from server!", PlayerName( playerid ), playerid );
SendClientMessageToAll( COLOR_GREY, str2 );
print( str2 );
SaveToFile( "KickLog", str2 );
}
if ( ServerInfo[ NameKick ] == 1 )
{
for ( new s = 0; s < BadNameCount; s++ )
{
if ( !strcmp( BadNames[ s ], PlayerName( playerid ), true ) )
{
SendClientMessage( playerid, COLOR_GREY, "Your name is on our {FFFF00}black list, {ACACAC}you have been kicked." );
format( string, sizeof( string ),"*** {FFFF00}%s (ID:%d) {ACACAC}was auto kicked. (Reason: {33CCFF}Forbidden name{ACACAC})",PlayerName( playerid ), playerid );
SendClientMessageToAll( COLOR_GREY, string );
print( string );
SaveToFile( "KickLog", string ); Kick( playerid );
return 1;
}
}
}
if ( ServerInfo[ PartNameKick ] == 1 )
{
for ( new s = 0; s < BadPartNameCount; s++ )
{
new pos;
while ( ( pos = strfind( PlayerName( playerid ), BadPartNames[ s ], true ) ) != -1 ) for ( new i = pos, j = pos + strlen( BadPartNames[ s ] ); i < j; i++ )
{
SendClientMessage( playerid, COLOR_GREY, "Your name is not allowed on this server, you have been kicked." );
format( string, sizeof( string ),"**** {FFFF00}%s (ID:%d) {ACACAC}was auto kicked. (Reason: {33CCFF}Forbidden name{ACACAC})",PlayerName( playerid ), playerid );
SendClientMessageToAll( COLOR_GREY, string ); print( string );
SaveToFile( "KickLog", string ); Kick( playerid );
return 1;
}
}
}
if ( ServerInfo[ Locked ] == 1 )
{
PlayerInfo[ playerid ][ AllowedIn ] = false;
SendClientMessage( playerid, COLOR_ULTRARED,"Server is Locked! You have {FFFF00}20 {E60000}seconds to enter the server password before you are kicked!" );
SendClientMessage( playerid, COLOR_ULTRARED,"Type {FFFFFF}/password [password]" );
LockKickTimer[ playerid ] = SetTimerEx( "AutoKick", 20000, 0, "i", playerid );
}
if ( strlen( dini_Get( "ladmin/config/aka.txt", tmp3 ) ) == 0 ) dini_Set( "ladmin/config/aka.txt", tmp3, PlayerName( playerid ) );
else
{
if ( strfind( dini_Get("ladmin/config/aka.txt", tmp3 ), PlayerName( playerid ), true ) == -1 )
{
format( string, sizeof( string ),"%s,%s", dini_Get("ladmin/config/aka.txt", tmp3 ), PlayerName( playerid ) );
dini_Set( "ladmin/config/aka.txt", tmp3, string );
}
}

SendClientMessage( playerid, COLOR_WHITE,"Welcome to {0000BB}Romania {FFFF00}Apocalypse {E60000}Stunt {FFFFFF}for more please type {33CCFF}/help{FFFFFF}!" );
SendClientMessage( playerid, COLOR_WHITE,"Use {E60000}/house {FFFFFF}to find information on our houses" );
SendClientMessage( playerid, COLOR_WHITE,"Type {33CCFF}/cmds {FFFFFF}for all commands !" );
SendClientMessage( playerid, COLOR_WHITE,"Use {E60000}/ro {FFFFFF}if you are romвn or {E60000}/eng {FFFFFF}if you are English." );
SendClientMessage( playerid, COLOR_WHITE,"Type {33CCFF}/teles {FFFFFF}to see teleportation on the server." );
SendClientMessage( playerid, COLOR_WHITE,"If you need a vehicle type {E60000}/V {FFFFFF}and if you want to tune cars write {E60000}/tune" );

TextDrawShowForPlayer( playerid, Weilcome );
TextDrawShowForPlayer( playerid, TO );
TextDrawShowForPlayer( playerid, Steam1 );
TextDrawShowForPlayer( playerid, Steam2 );
TextDrawShowForPlayer( playerid, Steam3 );
TextDrawShowForPlayer( playerid, HelpT );
TextDrawShowForPlayer( playerid, RulesT );
TextDrawShowForPlayer( playerid, CmdsT );
TextDrawShowForPlayer( playerid, TelesT );
TextDrawShowForPlayer( playerid, Steluta1 );
TextDrawShowForPlayer( playerid, Steluta2 );

if ( !udb_Exists( PlayerName2( playerid ) ) )
{
new rstr[ 256 ];
format( rstr, sizeof( rstr ), "{FFFFFF}Welcome {FFFF00}%s {FFFFFF}on {0000BB}Romania {FFFF00}Apocalypse {E60000}Stunt\n\n{FFFFFF}Please register to save your stats!: {FF5500}Score, Money, Coins...\n{FF5500}Password:", PlayerName( playerid ) );
ShowPlayerDialog( playerid, RegDialog, DIALOG_STYLE_INPUT, "{E60000}Register", rstr,"Register", "Let's Play" );
}
else
{
PlayerInfo[ playerid ][ Registered ] = 1;

format( file, sizeof( file ),"/ladmin/users/%s.sav", udb_encode( PlayerName( playerid ) ) );
new tmp2[ 256 ]; tmp2 = dini_Get( file,"ip" );
if ( ( !strcmp( tmp3, tmp2, true ) ) && ( ServerInfo[ AutoLogin ] == 1 ) )
{
LoginPlayer( playerid );
if ( PlayerInfo[ playerid ][ Level ] > 0 )
{
format( string, sizeof( string ),"\t\t{ACACAC}ACCOUNT:\n{FFFFFF}You have been automatically LoggedIn\n\n{FFFFFF}Admin Level: {00FF00}%d {FFFFFF}\n\n{FFFFFF}V.I.P Level: {00FF00}%d", PlayerInfo[ playerid ][ Level ], PlayerInfo[ playerid ][ pVip ] );
ShowPlayerDialog( playerid, OnLogin, DIALOG_STYLE_MSGBOX, "{00FF00}Logged in", string, "Quit", "" );
}
else ShowPlayerDialog( playerid, OnLogin, DIALOG_STYLE_MSGBOX, "{00FF00}Logged in", "\t\t{ACACAC}ACCOUNT:\n{FFFFFF}You have been automatically LoggedIn\n\n{FFFFFF}Admin Level: {00FF00}0 {FFFFFF}\n\n{FFFFFF}V.I.P Level: {00FF00}0", "Quit", "" );
}
else SendClientMessage( playerid, COLOR_GREEN, "ACCOUNT: {FFFFFF}This nickname is registed, you can now login by typing {00FF00}/login [Password]" );
}
return 1;
}

And gives me these errors:
Quote:

C:\Users\David\Desktop\Romania Apocalypse Stunt\Execute Compiler 2\include\YSI\y_iterate.inc(1056) : warning 219: local variable "s1" shadows a variable at a preceding level
C:\Users\David\Desktop\Romania Apocalypse Stunt\Execute Compiler 2\include\lethaldudb2.inc(36) : warning 219: local variable "s1" shadows a variable at a preceding level
C:\Users\David\Desktop\Romania Apocalypse Stunt\Execute Compiler 2\include\lethaldudb2.inc(37) : warning 219: local variable "s2" shadows a variable at a preceding level
C:\Users\David\Desktop\Romania Apocalypse Stunt\gamemodes\RAS.pwn(306) : error 017: undefined symbol "ServerInfo"
C:\Users\David\Desktop\Romania Apocalypse Stunt\gamemodes\RAS.pwn(306) : error 017: undefined symbol "ConnectMessages"
C:\Users\David\Desktop\Romania Apocalypse Stunt\gamemodes\RAS.pwn(306) : error 029: invalid expression, assumed zero
C:\Users\David\Desktop\Romania Apocalypse Stunt\gamemodes\RAS.pwn(306) : fatal error 107: too many error messages on one line

Please HELP !!
Reply
#2

1) s1 and s2 are already defined before, so remove any new s1 or new s2.

2) Must define ServerInfo with some enum with it. Also define Connect Messages.

High-light the lines with errors, we are not mediums.
Reply
#3

You have to define the enum ServerInfo, and change the s1 and s2 variable names.

pawn Код:
enum e_ServerInfo
{
    ConnectMessages,
    NameKick,
    PartNameKick,
    AutoLogin,
    Locked
    ...
};
new ServerInfo[e_ServerInfo];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)