Gang System ERROR
#1

pawn Код:
dcmd_gang( playerid, params[ ] )
{

    new gString[ MAX_CLIENT_MSG ], gangid = pData[ playerid ][ P_GANG_ID ];

    if ( params[ 0 ] == '\0' )
        return SendUsage( playerid, "/gang [CREATE/JOIN/QUIT/INFO/KICK/INVITE/SETLEADER] [PLAYERID/GANG_NAME/GANGID]" );
    else if ( !strcmp( params, "create", true, 6 ) )
    {
        if ( IsPlayerInAnyGang( playerid ) )
            return SendError( playerid, "You are already in a gang." );
        else if ( !strlen( params[ 7 ] ) )
            return SendUsage( playerid, "/gang create [GANG_NAME]" );
        else
        {
            strcpy( gString, params, 0, 7 );

            if ( CreateGang( playerid, gString ) != INVALID_GANG_ID )
            {
#if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
                print("Debug: 1 3237");
                lredraw(2);
#endif
                return 1;
            }
            else
                return SendError( playerid, "Gang could not be created." );
        }
    }

    else if ( !strcmp( params, "quit", true, 4 ) || !strcmp( params, "leave", true, 5 ) )
    {
        if ( !IsPlayerInAnyGang( playerid ) )
            return SendError( playerid, "You are not in a gang." );
        else
        {
            RemovePlayerFromGang( playerid, GANG_LEAVE_QUIT );
#if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
            lredraw(2);
#endif
            return 1;
        }
    }

    else if ( !strcmp ( params, "kick", true, 4 ) )
    {
        if ( pData[ playerid ][ P_GANG_POS ] )
            return SendError( playerid, "You must be gang leader to use this command." );
        else if ( !strlen( params[ 5 ] ) || !IsNumeric( params[ 5 ] ) )
            return SendUsage( playerid, "/gang kick [PLAYERID]" );

        new kick = strval( params[ 5 ] );

        if ( !IsPlayerConnected( kick ) )
            return SendError( playerid, "Player is not connected." );
        else if ( pData[ kick ][ P_GANG_ID ] != pData[ playerid ][ P_GANG_ID ] )
            return SendError( playerid, "You can only kick players in your gang." );
        else
        {
            RemovePlayerFromGang( kick, GANG_LEAVE_KICK, playerid );
#if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
            lredraw(2);
#endif
            return 1;
        }
    }

    else if ( !strcmp( params, "invite", true, 6 ) )
    {
//      if ( pData[ playerid ][ P_GANG_POS ] )
//       return SendError( playerid, "You must be gang leader to use this command." );

        if ( !IsPlayerInAnyGang( playerid ) )
            return SendError( playerid, "You must be in a gang to use this command." );
        else if ( !strlen( params[ 7 ] ) || !IsNumeric( params[ 7 ] ) )
            return SendUsage( playerid, "/gang invite [PLAYERID]" );

        new invite = strval( params[ 7 ] );

        if ( !IsPlayerConnected( invite ) )
            return SendError( playerid, "Player is not connected." );
        else if ( invite == playerid )
            return SendError( playerid, "Inviting yourself?" );

        else
        {
            GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
            format( gString, sizeof( gString ), "* %s (ID: %d) invited you to join %s (ID: %d). Type /gang join to join.", gString, playerid, gData[ gangid ][ G_NAME ], gangid );
            SendClientMessage( invite, COLOR_ORANGE, gString );

            GetPlayerName( invite, gString, MAX_PLAYER_NAME );
            format( gString, sizeof( gString ), "* Sent a gang invite to %s (ID: %d).", gString, invite );
            SendClientMessage( playerid, COLOR_GREEN, gString );

            pData[ invite ][ P_GANG_INVITE ] = pData[ playerid ][ P_GANG_ID ];
#if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
            lredraw(2);
#endif
            return 1;
        }
    }

    else if ( !strcmp( params, "info", true, 4 ) )
    {
        new gID = INVALID_GANG_ID;

        if ( !strlen( params[ 5 ] ) )
        {
            if ( !IsPlayerInAnyGang( playerid ) )
                return SendUsage( playerid, "/gang info [GANGID]" );
            else
                gID = pData[ playerid ][ P_GANG_ID ];
        }

        else if ( strlen( params[ 5 ] ) )
        {
            if ( !IsNumeric( params[ 5 ] ) )
                return SendUsage( playerid, "/gang info [GANGID]" );
            else
                gID = strval( params[ 5 ] );
        }

        if ( !IsValidGang( gID ) )
        {
            return SendError( playerid, "Enter a valid gang id." );
        }

        new pName[ MAX_PLAYER_NAME ], counter;

        format( gString, sizeof( gString ), "* Gang Information for %s (ID:%d):", gData[ gID ][ G_NAME ], gID );
        SendClientMessage( playerid, COLOR_GREEN, gString );
        GetPlayerName( gData[ gID ][ G_LEADER ], gString, MAX_PLAYER_NAME );
        format( gString, sizeof( gString ), "* Leader - %s (ID:%d) | Members - %d", gString, gData[ gID ][ G_LEADER ], gData[ gID ][ G_TOTALS ] );
        SendClientMessage( playerid, COLOR_YELLOW, gString );
        format( gString, sizeof( gString ), "* Kills - %d | Deaths - %d", gData[ gID ][ G_KILLS ], gData[ gID ][ G_DEATHS ] );

        if ( !gData[ gID ][ G_DEATHS ] || !gData[ gID ][ G_KILLS ] )
        {
            format( gString, sizeof( gString ), "%s | Kill Ratio - N/A", gString );
        }

        else
        {
            format( gString, sizeof( gString ), "%s | Kill Ratio - %.2f", gString, floatdiv( gData[ gID ][ G_KILLS ], gData[ gID ][ G_DEATHS ] ) );
        }

        SendClientMessage( playerid, COLOR_YELLOW, gString );
        gString = "* ";

        for ( new memberid = 0; memberid < gData[ gID ][ G_TOTALS ]; memberid++ )
        {
            if ( IsPlayerConnected( gData[ gID ][ G_MEMBERS ][ memberid ] ) )
            {
                GetPlayerName( gData[ gID ][ G_MEMBERS ][ memberid ], pName, MAX_PLAYER_NAME );

                if ( counter > 3 )
                {
                    SendClientMessage( playerid, COLOR_YELLOW, gString );
                    gString = "* ";
                    format( gString, sizeof( gString ), "%s%s (%d), ", gString, pName, gData[ gID ][ G_MEMBERS ][ memberid ] );
                    counter = 1;
                }
                else
                {
                    format( gString, sizeof( gString ), "%s%s (%d), ", gString, pName, gData[ gID ][ G_MEMBERS ][ memberid ] );
                    counter++;
                }
            }
        }

        if ( strlen( gString[ 2 ] ) )
            SendClientMessage( playerid, COLOR_YELLOW, gString );

        return 1;
    }

    else if ( !strcmp( params, "join", true, 4 ) )
    {
        if ( pData[ playerid ][ P_GANG_INVITE ] == INVALID_GANG_ID )
            return SendError( playerid, "You have not been invited to a gang." );
        else if ( gData[ pData[ playerid ][ P_GANG_INVITE ] ][ G_TOTALS ] >= MAX_GANG_MEMBERS )
            return SendError( playerid, "This gang is full." );
        else
        {
            if ( IsPlayerInAnyGang( playerid ) )
                RemovePlayerFromGang( playerid, GANG_LEAVE_QUIT );

            SetPlayerGang( playerid, pData[ playerid ][ P_GANG_INVITE ] );
            pData[ playerid ][ P_GANG_INVITE ] = INVALID_GANG_ID;
#if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
            lredraw(2);
#endif
            return 1;
        }
    }
/*  else if ( !strcmp( params, "alliance", true, 8 ) )
    {
        if ( !IsPlayerInAnyGang( playerid ) )
            return SendError( playerid, "You must be in a gang to use this command." );
        else if ( pData[ playerid ][ P_GANG_POS ] )
            return SendError( playerid, "You must be a gang leader to use this command." );
        else if ( !strlen( params[ 9 ] ) || !IsNumeric( params[ 10 ] ) )
            return SendUsage( playerid, "/gang alliance [gangid]" );

        new allyid = strval( params[ 9 ] );

        if ( !IsValidGang( allyid ) )
            return SendError( playerid, "Who are you trying to ally with!?" );
        else
        {
            gData[ pData[ playerid ][ P_GANG_ID ] ][ G_ALLY ] = allyid;

            format( gString, sizeof( gString ), "* Your gang has allied with %s (ID:%d).", gData[ allyid ][ G_NAME ], allyid );
            SendClientMessageToGang( pData[ playerid ][ P_GANG_ID ], COLOR_ORANGE, gString );
            format( gString, sizeof( gString ), "* %s (ID:%d) has made you their ally.", gData[ pData[ playerid ][ P_GANG_ID ] ][ G_NAME ], pData[ playerid ][ P_GANG_ID ] );
            SendClientMessageToGang( allyid, COLOR_ORANGE, gString );

            return 1;
        }
    }
*/

    else if ( !strcmp( params, "setleader", true, 9 ) )
    {
        if ( !IsPlayerInAnyGang( playerid ) )
            return SendError( playerid, "You must be in a gang to use this command." );
        else if ( pData[ playerid ][ P_GANG_POS ] )
            return SendError( playerid, "You must be the gang leader to use this command." );
        else if ( !strlen( params[ 10 ] ) || !IsNumeric( params[ 10 ] ) )
            return SendUsage( playerid, "/gang setleader [PLAYERID]" );

        new otherid = strval( params[ 10 ] );

        if ( !IsPlayerConnected( otherid ) )
            return SendError( playerid, "Player is not connected." );
        else if ( !IsPlayerInGang( otherid, pData[ playerid ][ P_GANG_ID ] ) )
            return SendError( playerid, "This player is not in your gang!" );
        else
        {
            new
                pName[ MAX_PLAYER_NAME ];

            gData[ gangid ][ G_MEMBERS ][ pData[ otherid ][ P_GANG_POS ] ]  = playerid;
            pData[ playerid ][ P_GANG_POS ]                                 = pData[ otherid ][ P_GANG_POS ];

            gData[ gangid ][ G_MEMBERS ][ 0 ]   = otherid;
            pData[ otherid ][ P_GANG_POS ]      = 0;

            gData[ pData[ playerid ][ P_GANG_ID ] ][ G_LEADER ] = otherid;
            gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ]  = pColors[ otherid ];

            GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
            GetPlayerName( otherid, gString, MAX_PLAYER_NAME );

            format( gString, sizeof( gString ), "* %s (ID:%d) has set %s (ID:%d) as gang leader.", pName, playerid, gString, otherid );

            if ( playerid != sRhinoOwner && playerid != sHighBountyPlayer )
                SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );

            for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
            {
                if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) )
                {
                    if ( sRhinoOwner == gData[ gangid ][ G_MEMBERS ][ memberid ] || sHighBountyPlayer == gData[ gangid ][ G_MEMBERS ][ memberid ] )
                    {
                        // We don't need to set "memberid"'s colour ...

                        for ( new omemberid = 0; omemberid < gData[ gangid ][ G_TOTALS ]; omemberid++ )
                        {
                            if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ omemberid ] ) )
                                continue;

                            // We need to set "omemberid"'s colour
                            if( sRhinoOwner != gData[ gangid ][ G_MEMBERS ][ omemberid ] && sHighBountyPlayer != gData[ gangid ][ G_MEMBERS ][ omemberid ] )
                                SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gData[ gangid ][ G_MEMBERS ][ omemberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
                        }
                    }

                    else
                    {
                        // We need to set memberid's colour.
                        SetPlayerColor( gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0x40 ) );

                        for ( new omemberid = 0; omemberid < gData[ gangid ][ G_TOTALS ]; omemberid++ )
                        {
                            if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ omemberid ] ) )
                                continue;

                            // We don't need to set "j"'s colour.
                            if ( sRhinoOwner == gData[ gangid ][ G_MEMBERS ][ omemberid ] || sHighBountyPlayer == gData[ gangid ][ G_MEMBERS ][ omemberid ] )
                                SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ omemberid ], gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );

                            // We need to set "j"'s and "i"'s colour.
                            else
                            {
                                SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gData[ gangid ][ G_MEMBERS ][ omemberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
                                SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ omemberid ], gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
                            }
                        }

                        SendClientMessage( gData[ gangid ][ G_MEMBERS ][ memberid ], COLOR_GREEN, gString );
                    }

                }
            }

            #if VERSION_LITE == false
            for ( new gZ = 0; gZ < sizeof( gZones ); gZ++ )
            {
                if ( gZones[ gZ ][ G_ZONE_OWNER ] == gangid )
                {
                    gZones[ gZ ][ G_ZONE_COLOR ] = ( gData[ gangid ][ G_COLOR ] & 0xFFFFFF00 ) | 0x80;

                    GangZoneShowForAll( gZones[ gZ ][ G_ZONE_ID ], gZones[ gZ ][ G_ZONE_COLOR ] );

                    if ( gZones[ gZ ][ G_ZONE_WAR ] )
                    {
                        GangZoneFlashForAll( gZones[ gZ ][ G_ZONE_ID ], 0xFF000080 );
                    }
                }
            }
            #endif

            return 1;
        }
    }
pawn Код:
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(158) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(169) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(184) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(211) : error 017: undefined symbol "dcmd_gang"
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(220) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(239) : error 017: undefined symbol "dcmd_gang"
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(240) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(242) : error 017: undefined symbol "MAX_CLIENT_MSG"
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(242) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Bureau\Dev\gamemodes\Walkies.pwn(242) : error 017: undefined symbol "gangid"
Reply


Messages In This Thread
Gang System ERROR - by AzTeCaS - 11.01.2011, 20:12
Re: Gang System ERROR - by blackwave - 11.01.2011, 20:38

Forum Jump:


Users browsing this thread: 1 Guest(s)