Помогите доработать

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
237
Симпатии
4
Пол
Мужской
хачу дабавить

new szAuthid[32] -> get_user_authid(id,authid,32)

и

new szRegion[32] -> geoip_region_name(ip,region, 64,2);

но не получается

вот оригинал
C++:
#include <amxmodx>
#include <amxmisc>
#include <geoipse>
#include <geoip>
#include <colorchat>

// http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

new Float:gflLongitude[33];
new Float:gflLatitude[33];
new bool:gIsUserConnected[33];
new gMaxplayers;

public plugin_init() {
    register_plugin( "City Connect Announcer", "1.0", "xPaw" );
   
    gMaxplayers = get_maxplayers( );
}

public client_putinserver( id ) {
    gIsUserConnected[id] = true;
   
    if( is_user_bot( id ) ) {
        gIsUserConnected[id] = false;    // lets make less loops in distance counting xD
       
        return PLUGIN_CONTINUE;
    }
   
    new szIP[32], szCountry[46], szCity[46], szName[32];
    get_user_name(id, szName, 31);
    get_user_ip( id, szIP, 31, 1 );
       
    geoip_country( szIP, szCountry );
    geoip_city( szIP, szCity );
   
    gflLatitude[id] = geoip_latitude( szIP );
    gflLongitude[id] = geoip_longitude( szIP );
   
    if( equal(szCountry, "error") ) {
        if( !contain(szIP, "192.168.") || !contain(szIP, "10. ") || !contain(szIP, "172.") || equal(szIP, "127.0.0.1") )
            szCountry = "LAN";
       
        else if( equal(szIP, "loopback") )
            szCountry = "LAN Owner";
       
        else
            szCountry = "Unknown Country";
    }
   
    // modifications:
    if( get_user_flags(id) & ADMIN_KICK ) {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 (%s) has connected from^x03 %s^x01,^x03 %s^x01.", szName, szIP, szCity, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 (%s) has connected from^x03 %s^x01.", szName, szIP, szCountry );
    } else {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 (%s) has connected from^x03 %s^x01,^x03 %s^x01.", szName, szIP, szCity, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 (%s) has connected from^x03 %s^x01.", szName, szIP, szCountry );
    }
    // end of modifications
   
    if( gflLongitude[id] != 0.0 && gflLatitude[id] != 0.0 )
        set_task( 0.2, "PrintDistance", id ); // gay fix.
   
    return PLUGIN_CONTINUE;
}

public PrintDistance( id ) {
    static i, szName[ 32 ];
    get_user_name( id, szName, 31 );
   
    for( i = 1; i <= gMaxplayers; i++ )
        if( gIsUserConnected[i] && id != i )
            if( gflLongitude[i] != 0.0 && gflLatitude[i] != 0.0 )
                ColorChat( i, RED, "[CityConnect] ^x01*^x04 %s^x01 is about^x03 %d^x01 kilometers far away from you.", szName, floatround( geoip_distance( gflLatitude[id], gflLatitude[i], gflLongitude[id], gflLongitude[i] ) ) );
}

public client_disconnect( id ) {
    gIsUserConnected[id] = false;
   
    if( is_user_bot( id ) )
        return PLUGIN_CONTINUE;
   
    new szIP[32], szCountry[46], szCity[46], szName[32];
    get_user_name(id, szName, 31);
    get_user_ip( id, szIP, 31, 1 );
    geoip_country( szIP, szCountry );
    geoip_city( szIP, szCity );
   
    if( equal(szCountry, "error") ) {
        if( !contain(szIP, "192.168.") || !contain(szIP, "10. ") || !contain(szIP, "172.") || equal(szIP, "127.0.0.1") )
            szCountry = "LAN";
       
        else if( equal(szIP, "loopback") )
            szCountry = "LAN Owner";
       
        else
            szCountry = "Unknown Country";
    }
   
    if( get_user_flags(id) & ADMIN_KICK ) {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 has disconnected from^x03 %s^x01,^x03 %s^x01.", szName, szCity, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 has disconnected from^x03 %s^x01.", szName, szCountry );
    } else {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 has disconnected from^x03 %s^x01,^x03 %s^x01.", szName, szCity, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 has disconnected from^x03 %s^x01.", szName, szCountry );
    }
   
    return PLUGIN_CONTINUE;
}

stock Float:geoip_distance( Float:flLat1, Float:flLat2, Float:flLon1, Float:flLon2 )
    return ( 6371.0 * floatacos( floatsin( flLat1 / 57.3 ) * floatsin( flLat2 / 57.3 ) + floatcos( flLat1 / 57.3 ) * floatcos( flLat2 / 57.3 ) * floatcos( flLon2 / 57.3 - flLon1 / 57.3 ), 0 ) )


и вот мой переделаны


C++:
#include <amxmodx>
#include <amxmisc>
#include <geoipse>
#include <geoip>
#include <colorchat>

// http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

new Float:gflLongitude[33];
new Float:gflLatitude[33];
new bool:gIsUserConnected[33];
new gMaxplayers;

public plugin_init() {
    register_plugin( "City Connect Announcer", "1.0", "xPaw" );
   
    gMaxplayers = get_maxplayers( );
}

public client_putinserver( id ) {
    gIsUserConnected[id] = true;
   
    if( is_user_bot( id ) ) {
        gIsUserConnected[id] = false;    // lets make less loops in distance counting xD
       
        return PLUGIN_CONTINUE;
    }
   
    new szIP[32], szCountry[46], szAuthid[33], szRegion[64], szCity[46], szName[32];
   
    get_user_name(id, szName, 31);
    get_user_authid(id,szAuthid,32),
    get_user_ip( id, szIP, 31, 1 );
       
    geoip_country( szIP, szCountry );
    geoip_region_name(ip,szRegion, 64,2);
    geoip_city( szIP, szCity );

    gflLatitude[id] = geoip_latitude( szIP );
    gflLongitude[id] = geoip_longitude( szIP );
   
    if( equal(szCountry, "error") ) {
        if( !contain(szIP, "192.168.") || !contain(szIP, "10. ") || !contain(szIP, "172.") || equal(szIP, "127.0.0.1") )
            szCountry = "LAN";
       
        else if( equal(szIP, "loopback") )
            szCountry = "LAN Owner";
       
        else
            szCountry = "Unknown Country";
    }
   
    // modifications:
    if( get_user_flags(id) & ADMIN_KICK ) {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 (%s) [%s] has connected from^x03 %s^x01,^x03 %s^x01 %s.", szName, szIP, szAuthid, szCity, szRegion, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 (%s) [%s] has connected from^x03 %s^x01 %s %s.", szName, szIP, szAuthid, szCity, szRegion, szCountry );
    } else {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 (%s) [%s] has connected from^x03 %s^x01,^x03 %s^x01 %s.", szName, szIP, szAuthid, szCity, szRegion, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 (%s) [%s] has connected from^x03 %s^x01 %s %s.", szName, szIP, szAuthid, szCity, szRegion, szCountry );
    }
    // end of modifications
   
    if( gflLongitude[id] != 0.0 && gflLatitude[id] != 0.0 )
        set_task( 0.2, "PrintDistance", id ); // gay fix.
   
    return PLUGIN_CONTINUE;
}

public PrintDistance( id ) {
    static i, szName[ 32 ];
    get_user_name( id, szName, 31 );
   
    for( i = 1; i <= gMaxplayers; i++ )
        if( gIsUserConnected[i] && id != i )
            if( gflLongitude[i] != 0.0 && gflLatitude[i] != 0.0 )
                ColorChat( i, RED, "[CityConnect] ^x01*^x04 %s^x01 is about^x03 %d^x01 kilometers far away from you.", szName, floatround( geoip_distance( gflLatitude[id], gflLatitude[i], gflLongitude[id], gflLongitude[i] ) ) );
}

public client_disconnect( id ) {
    gIsUserConnected[id] = false;
   
    if( is_user_bot( id ) )
        return PLUGIN_CONTINUE;
   
    new szIP[32], szCountry[46], szCity[46], szName[32];
    get_user_name(id, szName, 31);
    get_user_ip( id, szIP, 31, 1 );
    geoip_country( szIP, szCountry );
    geoip_city( szIP, szCity );
   
    if( equal(szCountry, "error") ) {
        if( !contain(szIP, "192.168.") || !contain(szIP, "10. ") || !contain(szIP, "172.") || equal(szIP, "127.0.0.1") )
            szCountry = "LAN";
       
        else if( equal(szIP, "loopback") )
            szCountry = "LAN Owner";
       
        else
            szCountry = "Unknown Country";
    }
   
    if( get_user_flags(id) & ADMIN_KICK ) {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 has disconnected from^x03 %s^x01,^x03 %s^x01.", szName, szCity, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01* Admin^x04 %s^x01 has disconnected from^x03 %s^x01.", szName, szCountry );
    } else {
        if( !equal( szCity, "error" ) )
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 has disconnected from^x03 %s^x01,^x03 %s^x01.", szName, szCity, szCountry );
        else
            ColorChat( 0, BLUE, "[CityConnect] ^x01*^x04 %s^x01 has disconnected from^x03 %s^x01.", szName, szCountry );
    }
   
    return PLUGIN_CONTINUE;
}

stock Float:geoip_distance( Float:flLat1, Float:flLat2, Float:flLon1, Float:flLon2 )
    return ( 6371.0 * floatacos( floatsin( flLat1 / 57.3 ) * floatsin( flLat2 / 57.3 ) + floatcos( flLat1 / 57.3 ) * floatcos( flLat2 / 57.3 ) * floatcos( flLon2 / 57.3 - flLon1 / 57.3 ), 0 ) )


geoip.inc(126) : error 021: symbol already defined: "geoip_city"
geoip.inc(126) : error 025: function heading differs from prototype
geoip.inc(187) : error 021: symbol already defined: "geoip_latitude"
geoip.inc(199) : error 021: symbol already defined: "geoip_longitude"
CityConnect.sma(32) : warning 217: loose indentation
CityConnect.sma(35) : warning 217: loose indentation
CityConnect.sma(36) : error 017: undefined symbol "ip"
CityConnect.sma(36) : warning 215: expression has no effect
CityConnect.sma(36) : warning 215: expression has no effect
CityConnect.sma(36) : warning 215: expression has no effect
CityConnect.sma(36) : error 001: expected token: ";", but found ")"
CityConnect.sma(36) : error 029: invalid expression, assumed zero
CityConnect.sma(36) : fatal error 107: too many error messages on one line

Compilation aborted.
8 Errors.
 

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
237
Симпатии
4
Пол
Мужской
bump
 
Сверху Снизу