29.10.2015, 14:12
Help to fix
Код:
D:\GTA San Andreas\Game\Server\scripts\anims.pwn(264) : error 017: undefined symbol "AutdoNOS" D:\GTA San Andreas\Game\Server\scripts\anims.pwn(264) : error 017: undefined symbol "playeri" D:\GTA San Andreas\Game\Server\scripts\anims.pwn(264) : error 029: invalid expression, assumed zero D:\GTA San Andreas\Game\Server\scripts\anims.pwn(264) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Код:
#define FILTERSCRIPT #include <a_samp> #include <zcmd> #define COLOR_WHITE 0xFFFFFFAA #undef MAX_PLAYERS #define MAX_PLAYERS 1 // Nusistatykit б tinkamа reikрmж // Suskirstom animacijas iр vieno failo б atskirus ( panaudojau nukopijavжs turinб iр wiki :D ) //#define LOAD #define ANIM_DIALOG 834 #if defined FILTERSCRIPT /* Kintamieji */ new bool:AutoNOS[MAX_PLAYERS]; new bool: OnAnimsMenu [ MAX_PLAYERS ], AnimLib [ 129 ] [ 50 ], AnimNam [ MAX_PLAYERS ] [ 300 ] [ 50 ], Text: AnimLibText [ MAX_PLAYERS ] [ 10 ], Text: AnimNamText [ MAX_PLAYERS ] [ 10 ], Text: SL [ MAX_PLAYERS ], Pointer [ MAX_PLAYERS ], ALibPointer [ MAX_PLAYERS ], ANamPointer [ MAX_PLAYERS ], CurrentLib [ MAX_PLAYERS ], CurrentAnim [ MAX_PLAYERS ], Selection [ MAX_PLAYERS ]; new Text: BG, Text: BG2; new Float: AnimSpeed [ MAX_PLAYERS ], bool: AnimLoop [ MAX_PLAYERS ], bool: AnimLockX [ MAX_PLAYERS ], bool: AnimLockY [ MAX_PLAYERS ], bool: AnimFreeze [ MAX_PLAYERS ], AnimTime [ MAX_PLAYERS ], bool: AnimFS [ MAX_PLAYERS ], bool: AnimControl [ MAX_PLAYERS ]; new Text: CFGText [ MAX_PLAYERS ] [ 8 ]; new const LIBS = 129; new Timer [ MAX_PLAYERS ]; /* Forwards */ forward DetectKeys ( playerid ); /* Callbacks */ public OnFilterScriptInit ( ) { #if defined LOAD LoadFrom ( "Anims/anims.txt" ); #endif CreateLibrariesTexts ( ); BG = TextDrawCreate ( 410.0, 110.0, "_" ); TextDrawUseBox ( BG, true ); TextDrawBoxColor ( BG, 0x0000009F ); TextDrawTextSize ( BG, 620.0, 1.0 ); TextDrawLetterSize ( BG, 1.0, 18.0 ); BG2 = TextDrawCreate ( 410.0, 290.0, "_" ); TextDrawUseBox ( BG2, true ); TextDrawBoxColor ( BG2, 0x0000009F ); TextDrawTextSize ( BG2, 510.0, 1.0 ); TextDrawLetterSize ( BG2, 1.0, 16.0 ); for ( new playerid = 0; playerid < MAX_PLAYERS; playerid ++ ) { SL [ playerid ] = TextDrawCreate ( 420.0, 130.0, "_" ); TextDrawUseBox ( SL [ playerid ], true ); TextDrawBoxColor ( SL [ playerid ], 0xFFFF4FFF ); TextDrawTextSize ( SL [ playerid ], 510.0, 1 ); for ( new i; i < 10; i ++ ) { if ( i < 8 ) { CFGText [ playerid ] [ i ] = TextDrawCreate ( 420.0, 300.0 + 15 * i, "_" ); TextDrawSetShadow ( CFGText [ playerid ] [ i ], 0 ); TextDrawFont ( CFGText [ playerid ] [ i ], 2 ); TextDrawColor ( CFGText [ playerid ] [ i ], 0xFF0000FF ); TextDrawLetterSize ( CFGText [ playerid ] [ i ], 0.2, 0.9 ); } AnimLibText [ playerid ] [ i ] = TextDrawCreate ( 420.0, 120.0 + 15 * i, "Text" ); TextDrawSetShadow ( AnimLibText [ playerid ] [ i ], 0 ); TextDrawFont ( AnimLibText [ playerid ] [ i ], 2 ); TextDrawColor ( AnimLibText [ playerid ] [ i ], 0xFF0000FF ); TextDrawLetterSize ( AnimLibText [ playerid ] [ i ], 0.2, 0.9 ); AnimNamText [ playerid ] [ i ] = TextDrawCreate ( 520.0, 120.0 + 15 * i, "Text" ); TextDrawSetShadow ( AnimNamText [ playerid ] [ i ], 0 ); TextDrawFont ( AnimNamText [ playerid ] [ i ], 2 ); TextDrawColor ( AnimNamText [ playerid ] [ i ], 0xFF0000FF ); TextDrawLetterSize ( AnimNamText [ playerid ] [ i ], 0.2, 0.9 ); } } } public OnFilterScriptExit ( ) { for ( new playerid = 0; playerid < MAX_PLAYERS; playerid ++ ) { if ( OnAnimsMenu [ playerid ] ) DisablePlayerAnimsMenu ( playerid ); } TextDrawDestroy ( BG ); TextDrawDestroy ( BG2 ); } CMD:afk(playerid, params []) { new string[129], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); SendClientMessage(playerid, COLOR_WHITE, "You are now AFK."); format(string,sizeof string, "%s is now AFK (Away From Keyboard).",pName); SendClientMessageToAll(0xFF0000AA,string); TogglePlayerControllable(playerid, 0); return 1; } CMD:brb(playerid, params []) { new string[129], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); SendClientMessage(playerid, COLOR_WHITE, "You are now Be Right Back."); format(string,sizeof string, "%s is now BRB (Be Right Back).",pName); SendClientMessageToAll(0xFF0000AA,string); TogglePlayerControllable(playerid, 0); return 1; } CMD:back(playerid, params []) { new string[129], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); SendClientMessage(playerid, COLOR_WHITE, "You came Back)."); format(string,sizeof string, "%s is Back to game).",pName); SendClientMessageToAll(0xFF0000AA,string); TogglePlayerControllable(playerid, 1); return 1; } #endif public OnPlayerConnect ( playerid ) { if ( playerid >= MAX_PLAYERS ) return Kick ( playerid ); OnAnimsMenu [ playerid ] = false; TextDrawHideForPlayer ( playerid, SL [ playerid ] ); TextDrawHideForPlayer ( playerid, BG ); TextDrawHideForPlayer ( playerid, BG2 ); for ( new i; i < 10; i ++ ) { if ( i < 8 ) TextDrawHideForPlayer ( playerid, CFGText [ playerid ] [ i ] ); TextDrawHideForPlayer ( playerid, AnimLibText [ playerid ] [ i ] ); TextDrawHideForPlayer ( playerid, AnimNamText [ playerid ] [ i ] ); } return 1; } public OnPlayerDisconnect ( playerid, reason ) { if ( OnAnimsMenu [ playerid ] ) DisablePlayerAnimsMenu ( playerid ); return 1; } public OnPlayerKeyStateChange ( playerid, newkeys, oldkeys ) { if ( OnAnimsMenu [ playerid ] ) { if ( ( oldkeys & KEY_SPRINT ) && !( newkeys & KEY_SPRINT ) ) { if ( Selection [ playerid ] == 1 ) { new String [ 128 ]; format ( String, 128, "Playing Animation: {FFFFFF}%s, {FF0000}from library: {FFFFFF}%s", AnimNam [ playerid ] [ CurrentAnim [ playerid ] ], AnimLib [ CurrentLib [ playerid ] ] ); SendClientMessage ( playerid, 0xFF0000FF, String ); ClearAnimations ( playerid ); ApplyAnimation ( playerid, AnimLib [ CurrentLib [ playerid ] ], AnimNam [ playerid ] [ CurrentAnim [ playerid ] ], AnimSpeed [ playerid ], AnimLoop [ playerid ], AnimLockX [ playerid ], AnimLockY [ playerid ], AnimFreeze [ playerid ], AnimTime [ playerid ], AnimFS [ playerid ] ); } else if ( Selection [ playerid ] == 2 ) { switch ( Pointer [ playerid ] ) { case 0: ShowPlayerDialog ( playerid, ANIM_DIALOG, DIALOG_STYLE_INPUT, "Anim Speed", "Type animation speed ( float number )", "Change", "Back" ); case 1: AnimLoop [ playerid ] = !AnimLoop [ playerid ]; case 2: AnimLockX [ playerid ] = !AnimLockX [ playerid ]; case 3: AnimLockY [ playerid ] = !AnimLockY [ playerid ]; case 4: AnimFreeze [ playerid ] = !AnimFreeze [ playerid ]; case 5: ShowPlayerDialog ( playerid, ANIM_DIALOG + 1, DIALOG_STYLE_INPUT, "Anim Time", "Type animation time ( miliseconds )", "Change", "Back" ); case 6: AnimFS [ playerid ] = !AnimFS [ playerid ]; case 7: { AnimControl [ playerid ] = !AnimControl [ playerid ]; TogglePlayerControllable ( playerid, AnimControl [ playerid ] ); } } UpdateCFGTexts ( playerid ); } } } return 1; } public OnPlayerCommandText ( playerid, cmdtext [ ] ) { if ( !strcmp ( cmdtext, "/animmenu", true, 9 ) ) if(!strcmp(cmdtext, "/autonos", true)) { if ( OnAnimsMenu [ playerid ] ) if ( AutdoNOS [ playeri ] ) { SendClientMessage(playerid, 0x924161FF, "[ ! ] Automatic nitro deactivated."); AutoNOS[playerid] = false; } else { SendClientMessage(playerid, 0x924161FF, "[ ! ] Automatic nitro activated!"); AutoNOS[playerid] = true; } DisablePlayerAnimsMenu ( playerid ); return 1; } CurrentLib [ playerid ] = 0; CurrentAnim [ playerid ] = 0; Selection [ playerid ] = 0; Pointer [ playerid ] = 0; ALibPointer [ playerid ] = 0; ANamPointer [ playerid ] = 0; AnimSpeed [ playerid ] = 4.1; AnimLoop [ playerid ] = true; AnimLockX [ playerid ] = true; AnimLockY [ playerid ] = true; AnimFreeze [ playerid ] = true; AnimTime [ playerid ] = 1; AnimFS [ playerid ] = true; AnimControl [ playerid ] = true; new CLib = CurrentLib [ playerid ], i; if ( !CreateAnimsTexts ( playerid, AnimLib [ CLib ] ) ) print ( AnimLib [ playerid ] [ CLib ] ); ListLibs ( playerid ); ListAnims ( playerid, AnimLib [ CLib ] ); TextDrawShowForPlayer ( playerid, BG ); TextDrawShowForPlayer ( playerid, BG2 ); TextDrawShowForPlayer ( playerid, SL [ playerid ] ); for ( i = 0; i < 10; i ++ ) { if ( i < 8 ) TextDrawShowForPlayer ( playerid, CFGText [ playerid ] [ i ] ); TextDrawShowForPlayer ( playerid, AnimLibText [ playerid ] [ i ] ); TextDrawShowForPlayer ( playerid, AnimNamText [ playerid ] [ i ] ); } for ( i = 0; i < LIBS; i ++ ) ApplyAnimation ( playerid, AnimLib [ i ], "null", 0.0, 0, 0, 0, 0, 0, 0 ); UpdateCFGTexts ( playerid ); OnAnimsMenu [ playerid ] = true; Timer [ playerid ] = SetTimerEx ( "DetectKeys", 125, 1, "d", playerid ); return 1; } return 0; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && AutoNOS[playerid] && (newkeys & KEY_ACTION || newkeys & KEY_FIRE)) AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); return 1; } public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [ ] ) { if ( dialogid == ANIM_DIALOG ) { if ( !response ) return 0; AnimSpeed [ playerid ] = floatstr ( inputtext ); UpdateCFGTexts ( playerid ); return 1; } else if ( dialogid == ANIM_DIALOG + 1 ) { if ( !response ) return 0; AnimTime [ playerid ] = strval ( inputtext ); UpdateCFGTexts ( playerid ); return 1; } return 1; } public DetectKeys ( playerid ) { new keys, updown, leftright; GetPlayerKeys ( playerid, keys, updown, leftright ); if ( updown < 0 ) { SetSelectionUp ( playerid ); } else if ( updown > 0 ) { SetSelectionDown ( playerid ); } else if ( leftright > 0 ) { if ( Selection [ playerid ] == 0 ) { Selection [ playerid ] = 1; ALibPointer [ playerid ] = Pointer [ playerid ]; Pointer [ playerid ] = 0; } else if ( Selection [ playerid ] == 1 ) { Selection [ playerid ] = 2; ANamPointer [ playerid ] = Pointer [ playerid ]; Pointer [ playerid ] = 0; } } else if ( leftright < 0 ) { if ( Selection [ playerid ] == 2 ) { Selection [ playerid ] = 1; Pointer [ playerid ] = ANamPointer [ playerid ]; } else if ( Selection [ playerid ] == 1 ) { Selection [ playerid ] = 0; Pointer [ playerid ] = ALibPointer [ playerid ]; } } SetPointer ( playerid ); SetPlayerVelocity ( playerid, 0.0, 0.0, 0.0 ); return 1; } /* Funkcijos */ DisablePlayerAnimsMenu ( playerid ) { ClearAnimations ( playerid ); TogglePlayerControllable ( playerid, true ); OnAnimsMenu [ playerid ] = false; KillTimer ( Timer [ playerid ] ); TextDrawHideForPlayer ( playerid, SL [ playerid ] ); TextDrawHideForPlayer ( playerid, BG ); TextDrawHideForPlayer ( playerid, BG2 ); for ( new i; i < 10; i ++ ) { if ( i < 8 ) TextDrawHideForPlayer ( playerid, CFGText [ playerid ] [ i ] ); TextDrawHideForPlayer ( playerid, AnimLibText [ playerid ] [ i ] ); TextDrawHideForPlayer ( playerid, AnimNamText [ playerid ] [ i ] ); } TextDrawDestroy ( SL [ playerid ] ); for ( new i; i < 10; i ++ ) { if ( i < 8 ) TextDrawDestroy ( CFGText [ playerid ] [ i ] ); TextDrawDestroy ( AnimLibText [ playerid ] [ i ] ); TextDrawDestroy ( AnimNamText [ playerid ] [ i ] ); } } UpdateCFGTexts ( playerid ) { new String [ 40 ]; format ( String, 40, "Speed : %0.2f", AnimSpeed [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 0 ], String ); format ( String, 40, "Loop : %d", AnimLoop [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 1 ], String ); format ( String, 40, "LockX : %d", AnimLockX [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 2 ], String ); format ( String, 40, "LockY : %d", AnimLockY [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 3 ], String ); format ( String, 40, "Freeze: %d", AnimFreeze [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 4 ], String ); format ( String, 40, "Time : %d", AnimTime [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 5 ], String ); format ( String, 40, "Sync : %d", AnimFS [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 6 ], String ); format ( String, 40, "Contr : %d", AnimControl [ playerid ] ); TextDrawSetString ( CFGText [ playerid ] [ 7 ], String ); } GetAnimsInLib ( lib [ ] ) { new libfile [ 60 ]; format ( libfile, 60, "Anims/%s.txt", lib ); if ( !fexist ( libfile ) ) return -1; new anims_count = 0, File: file = fopen ( libfile, io_read ), line [ 50 ]; while ( fread ( file, line, 50 ) ) anims_count ++; fclose ( file ); return anims_count; } CreateLibrariesTexts ( ) { new File: file, line [ 50 ], i = 0; if ( !fexist ( "Anims/libs.txt" ) ) return 0; file = fopen ( "Anims/libs.txt", io_read ); while ( fread ( file, line, 50 ) ) { new p = strfind ( line, "\r\n" ); if ( p != -1 ) strdel ( line, p, strlen ( line ) ); format ( AnimLib [ i ], 50, "%s", line ); i ++; } fclose ( file ); return 1; } CreateAnimsTexts ( playerid, lib [ ] ) { new libfile [ 50 ], File: file, line [ 50 ], i = 0; format ( libfile, 50, "Anims/%s.txt", lib ); if ( !fexist ( libfile ) ) return 0; file = fopen ( libfile, io_read ); while ( fread ( file, line, 50 ) ) { new p = strfind ( line, "\r\n" ); if ( p != -1 ) strdel ( line, p, strlen ( line ) ); p = strfind ( line, " " ); if ( p != -1 ) strdel ( line, p, strlen ( line ) ); format ( AnimNam [ playerid ] [ i ], 50, "%s", line ); i ++; } fclose ( file ); return 1; } ListLibs ( playerid ) { new i, j = 0; if ( Pointer [ playerid ] == 10 ) { Pointer [ playerid ] = 9; i = CurrentLib [ playerid ] - 9; } else { i = CurrentLib [ playerid ]; } while ( ( i < LIBS ) && ( j < 10 ) ) { TextDrawSetString ( AnimLibText [ playerid ] [ j ], AnimLib [ i ] ); j ++; i ++; } } ListAnims ( playerid, lib [ ] ) { new anims = GetAnimsInLib ( lib ); if ( anims > -1 ) { new i = CurrentAnim [ playerid ], j = 0; if ( Pointer [ playerid ] == 10 ) { Pointer [ playerid ] = 9; i = CurrentAnim [ playerid ] - 9; } else { i = CurrentAnim [ playerid ]; } while ( ( i < anims ) && ( j < 10 ) ) { TextDrawSetString ( AnimNamText [ playerid ] [ j ], AnimNam [ playerid ] [ i ] ); j ++; i ++; if ( i == anims ) for ( new u = j; u < 10; u ++ ) TextDrawSetString ( AnimNamText [ playerid ] [ u ], "_" ); } } } SetSelectionDown ( playerid ) { if ( Selection [ playerid ] == 0 ) { if ( CurrentLib [ playerid ] == ( LIBS - 1 ) ) { Pointer [ playerid ] = 9; } else { Pointer [ playerid ] ++; CurrentLib [ playerid ] ++; if ( Pointer [ playerid ] == 10 ) ListLibs ( playerid ); } SetPointer ( playerid ); CurrentAnim [ playerid ] = 0; if ( !CreateAnimsTexts ( playerid, AnimLib [ CurrentLib [ playerid ] ] ) ) print ( AnimLib [ CurrentLib [ playerid ] ] ); ListAnims ( playerid, AnimLib [ CurrentLib [ playerid ] ] ); } else if ( Selection [ playerid ] == 1 ) { new an = GetAnimsInLib ( AnimLib [ CurrentLib [ playerid ] ] ) - 1; if ( CurrentAnim [ playerid ] != an ) { Pointer [ playerid ] ++; CurrentAnim [ playerid ] ++; if ( Pointer [ playerid ] == 10 ) ListAnims ( playerid, AnimLib [ CurrentLib [ playerid ] ] ); } SetPointer ( playerid ); } else if ( Selection [ playerid ] == 2 ) { if ( Pointer [ playerid ] != 7 ) { Pointer [ playerid ] ++; } SetPointer ( playerid ); } } SetSelectionUp ( playerid ) { if ( Selection [ playerid ] == 0 ) { if ( CurrentLib [ playerid ] == 0 ) { Pointer [ playerid ] = 0; } else { Pointer [ playerid ] --; CurrentLib [ playerid ] --; if ( Pointer [ playerid ] < 0 ) { ListLibs ( playerid ); Pointer [ playerid ] = 0; } } SetPointer ( playerid ); CurrentAnim [ playerid ] = 0; if ( !CreateAnimsTexts ( playerid, AnimLib [ CurrentLib [ playerid ] ] ) ) print ( AnimLib [ CurrentLib [ playerid ] ] ); ListAnims ( playerid, AnimLib [ CurrentLib [ playerid ] ] ); } else if ( Selection [ playerid ] == 1 ) { if ( CurrentAnim [ playerid ] == 0 ) { Pointer [ playerid ] = 0; } else { Pointer [ playerid ] --; CurrentAnim [ playerid ] --; if ( Pointer [ playerid ] < 0 ) { ListAnims ( playerid, AnimLib [ CurrentLib [ playerid ] ] ); Pointer [ playerid ] = 0; } } SetPointer ( playerid ); } else if ( Selection [ playerid ] == 2 ) { if ( Pointer [ playerid ] != 0 ) { Pointer [ playerid ] --; } SetPointer ( playerid ); } } SetPointer ( playerid ) { TextDrawHideForPlayer ( playerid, SL [ playerid ] ); TextDrawDestroy ( SL [ playerid ] ); if ( Selection [ playerid ] == 0 ) { SL [ playerid ] = TextDrawCreate ( 420.0, 120.0 + 15.0 * Pointer [ playerid ], "_" ); TextDrawTextSize ( SL [ playerid ], 510.0, 1 ); TextDrawBoxColor ( SL [ playerid ], 0xFFFF4FFF ); } else if ( Selection [ playerid ] == 1 ) { SL [ playerid ] = TextDrawCreate ( 520.0, 120.0 + 15.0 * Pointer [ playerid ], "_" ); TextDrawTextSize ( SL [ playerid ], 610.0, 1 ); TextDrawBoxColor ( SL [ playerid ], 0xFFFF4FFF ); } else if ( Selection [ playerid ] == 2 ) { SL [ playerid ] = TextDrawCreate ( 420.0, 300.0 + 15.0 * Pointer [ playerid ], "_" ); TextDrawTextSize ( SL [ playerid ], 500.0, 1 ); TextDrawBoxColor ( SL [ playerid ], 0xFFFF4FFF ); } TextDrawUseBox ( SL [ playerid ], true ); TextDrawShowForPlayer ( playerid, SL [ playerid ] ); } #if defined LOAD LoadFrom ( animfile [ ] ) { if ( !fexist ( animfile ) ) return 0; new File: file = fopen ( animfile, io_read ), line [ 50 ], total_libraries = 0, total_anims = 0, bool: lib = false, currlib [ 60 ]; print ( "\nAnimations Writing..." ); while ( fread ( file, line, 50 ) ) { new File: libfile, str [ 50 ]; if ( lib ) { new File: newfile; if ( !fexist ( "Anims/libs.txt" ) ) { newfile = fopen ( "Anims/libs.txt", io_write ); fclose ( newfile ); } newfile = fopen ( "Anims/libs.txt", io_append ); new p = strfind ( line, "\r\n" ); if ( p != -1 ) strdel ( line, p, strlen ( line ) ); format ( str, 50, "%s\r\n", line ); format ( currlib, 60, "Anims/%s.txt", line ); fwrite ( newfile, str ); fclose ( newfile ); printf ( "Writing library %s...", line ); lib = false; total_libraries ++; continue; } if ( strfind ( line, "[edit]" ) != -1 ) { lib = true; continue; } new pos = strfind ( line, "*" ); if ( pos == -1 ) continue; if ( !fexist ( currlib ) ) { libfile = fopen ( currlib, io_write ); fclose ( libfile ); } libfile = fopen ( currlib, io_append ); format ( str, 50, "%s", line [ pos + 2 ] ); fwrite ( libfile, str ); fclose ( libfile ); total_anims ++; } print ( "Animations writing done" ); printf ( "Writed %d libraries", total_libraries ); printf ( "Writed %d anims\n", total_anims ); fclose ( file ); return 1; } #endif