Page 1 of 1
Cerere la oras/tara
Posted: 04 Aug 2019, 13:20
by Cs-3r4z3r
Plugin Cerut:connectinfo
Descriere (adica ce face el mai exact):cerere la el toate necesare fara sa dea eroare la oras si tara,va rog frumos.
Serverul ruleaza (HLDS/ReHLDS):REHLDS
Versiune AMX Mod X:1.8.2
Modul Serverului:Classic
Re: Cerere la oras/tara
Posted: 04 Aug 2019, 13:43
by (c) WaRninG.
- | Afiseaza codul
#include < amxmodx >
#include < geoip >
#pragma semicolon 1
static const PLUGIN[ ] = "Player Announce";
static const VERSION[ ] = "1.0";
native geoip_city( const ip[], result[], len );
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, "Unhask" );
}
public client_putinserver ( id )
{
set_task ( 2.2, "TskShowMSg", id, _, _, "b", _ );
}
public TskShowMSg ( id )
{
new szName[ 33 ], szIP[ 33 ], szCountry[ 45 ], szCity[ 45 ];
get_user_ip ( id, szIP, charsmax ( szIP ) );
get_user_name ( id, szName, charsmax ( szName ) );
geoip_country ( szIP, szCountry, charsmax ( szCountry ) );
geoip_city( szIP, szCity, charsmax ( szCity ) );
chat_color( 0, "!nPlayer !g%s !nconnected from !n[!t%s!n] [!t%s!n]", szName, szCountry, szCity );
}
stock chat_color( const id, const input[ ], any:... )
{
new iNum = 1, iPlayers[ 32 ];
new szMsg[ 191 ];
vformat( szMsg, sizeof ( szMsg ) - 1, input, 3 );
replace_all( szMsg, sizeof ( szMsg ) - 1, "!g", "^4" );
replace_all( szMsg, sizeof ( szMsg ) - 1, "!n", "^1" );
replace_all( szMsg, sizeof ( szMsg ) - 1, "!t", "^3" );
if ( id ) iPlayers[ 0 ] = id; else get_players( iPlayers, iNum, "ch" );
{
for ( new i = 0; i < iNum; i ++ )
{
if ( is_user_connected( iPlayers[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, iPlayers[ i ] );
write_byte( iPlayers[ i ] );
write_string( szMsg );
message_end( );
}
}
}
}
Dar trebuie sa pui geoip.inc in scripting->include,altfel nu v-a functiona. Ti l-am pus mai jos :)
- | Afiseaza codul
/*
GeoIP module functions for AMX Mod X
by David "BAILOPAN" Anderson.
Modified by Arkshine.
(C) Copyrighted under the GNU General Public License, Version 2
*/
#if defined geoip_included
#endinput
#endif
#define _geoip_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib geoip
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib geoip
#endif
#else
#pragma library geoip
#endif
/// IP addresses passed to these natives can contain ports, the ports will be ignored.
/**
* look up the two character country code for a given IP address.
* e.g: "US", "CA", etc.
*
* @param ip The IP address to look up.
* @param result The result buffer. If the look up does not succeed, the buffer is not modified.
* @return true on a successful look up, false on a failed look up.
*/
native bool:geoip_code2_ex( const ip[], result[3] );
/**
* look up the three character country code for a given IP address.
* e.g: "USA", "CAN", etc.
*
* @param ip The IP address to look up.
* @param result The result buffer. If the look up does not succeed, the buffer is not modified.
* @return true on a successful look up, false on a failed look up.
*/
native bool:geoip_code3_ex( const ip[], result[4] );
/**
* @deprecated
* look up the two character country code for a given IP address.
*
* @note This native will overflow the buffer by one cell on an unknown ip look up!
* @note Use geoip_code2_ex instead!
*
* @param ip The IP address to look up.
* @param result The result buffer.
*/
native geoip_code2( const ip[], ccode[3] );
/**
* @deprecated
* look up the three character country code for a given IP address.
*
* @note This native will overflow the buffer by one cell on an unknown ip look up!
* @note Use geoip_code3_ex instead!
*
* @param ip The IP address to look up.
* @param result The result buffer.
*/
native geoip_code3( const ip[], result[4]) ;
/**
* look up the full country name for the given IP address. Sets the buffer to "error" on
* an unsuccessful look up.
*
* @param ip The IP address to look up.
* @param result The result of the geoip look up.
* @param len The maximum length of the result buffer.
*/
native geoip_country( const ip[], result[], len );
/**
* look up the full city name for the given IP address. Sets the buffer to "error" on
* an unsuccessful look up.
*
* @param ip The IP address to look up.
* @param result The result of the geoip look up.
* @param len The maximum length of the result buffer.
*/
native geoip_city( const ip[], result[], len );
/**
* look up the city's latitude for the given IP address.
*
* @param ip The IP address to look up.
* @return The result of the geoip look up, 0 if latitude is not found.
*/
native Float:geoip_latitude( const ip[] );
/**
* look up the city's longitude for the given IP address. Returns
*
* @param ip The IP address to look up.
* @return The result of the geoip look up, 0 if longitude is not found.
*/
native Float:geoip_longitude( const ip[] );
/**
* look up the region/state code for the given IP address.
* e.g: "OH", "CA", "11", etc.
*
* @note It can be a number depending.
*
* @param ip The IP address to look up.
* @param result The result of the geoip look up.
* @return true on a successful look up, false on a failed look up.
*/
native bool:geoip_region( const ip[], result[4] );
/**
* look up the full region/state name for the given IP address. Sets the buffer to "error" on
* an unsuccessful look up.
*
* @param ip The IP address to look up.
* @param result The result of the geoip look up.
* @param len The maximum length of the result buffer.
*/
native geoip_region_name( const ip[], result[], len );
/**
* Look up the full time zone for the given IP address. Sets the buffer to "error" on
* an unsuccessful look up.
*
* @param ip The IP address to look up.
* @param result The result of the geoip look up.
* @param len The maximum length of the result buffer.
*/
native geoip_timezone( const ip[], result[], len );
/**
* Look up the continent code for a given IP address.
*
* @note The code can be retrieved as integer or string (2 characters).
* @note Possible continent codes are AF, AS, EU, NA, OC, SA for
* Africa(1), Asia(2), Europe(3), North America(4), Oceania(5) and South America(6).
*
* @param ip The IP address to look up.
* @param result The result of the geoip look up. This param is optional.
* If the look up does not succeed, the buffer is not modified.
* @return The result of the geoip look up, 0 on a failed look up.
*/
enum Continent
{
CONTINENT_ERROR = 0,
AFRICA,
ASIA,
EUROPE,
NORTH_AMERICA,
OCEANIA,
SOUTH_AMERICA
}
native Continent:geoip_continent_code( const ip[], result[3] = "" );
/**
* Calculate the distance between geographical coordinates, latitude and longitude.
*
* @param lat1 The first IP latitude.
* @param lon1 The first IP longitude.
* @param lat2 The second IP latitude.
* @param lon2 The second IP longitude.
* @param system The system of measurement, 0 = Meteric(kilometers) or 1 = English(miles).
* @return The distance as result in specified system of measurement.
*/
native Float:geoip_distance( Float:lat1, Float:lon1, Float:lat2, Float:lon2, system = 0 );
LINK OFICIAL -
cereri-pluginuri/tara-unde-provii-t211115.html
Re: Cerere la oras/tara
Posted: 04 Aug 2019, 13:45
by Cs-3r4z3r
Tu nu cred ca ai vazut ce am cerut eu.
Re: Cerere la oras/tara
Posted: 04 Aug 2019, 13:50
by (c) WaRninG.
Asta e ceea ce am inteles eu, daca noi nu stim sa scriem corect, este alta treaba..
Re: Cerere la oras/tara
Posted: 04 Aug 2019, 14:01
by Cs-3r4z3r
Du-te prietene,nu ai ce face altceva ?
Re: Cerere la oras/tara
Posted: 04 Aug 2019, 15:08
by @IONUTZ
Cs-3r4z3r wrote: ↑04 Aug 2019, 13:20
Plugin Cerut:connectinfo
Descriere (adica ce face el mai exact):cerere la el toate necesare fara sa dea eroare la oras si tara,va rog frumos.
Serverul ruleaza (HLDS/ReHLDS):REHLDS
Versiune AMX Mod X:1.8.2
Modul Serverului:Classic
Oricum o sa-ti dea eroare la unii playeri si la oras si la tara orice plugin ai pune deoarece geoip nu poate sa-ti ofere toate locatiile din lume
- | Afiseaza codul
#include amxmodx
#include geoip
#include ColorChat
public client_putinserver(id)
{
new name[32], ip[32], country[32], city[32];
get_user_name(id, name, charsmax(name));
get_user_ip(id, ip, charsmax(ip), 1);
geoip_country(ip, country, charsmax (country))
geoip_city(ip, city, charsmax(city))
ColorChat(0, GREEN, "^3%s^1 connected from [^4%s^1] [^4%s^1]", name, country, city);
}
http://www.girlshare.ro/3769765667.8
In data pui GeoLite2-City.mmdb si GeoLite2-Country.mmdb iar in scripting-include geoip.inc
Re: Cerere la oras/tara
Posted: 04 Aug 2019, 15:50
by Cs-3r4z3r
acum am vazut ca am gresit,si scuze.
Re: Cerere la oras/tara
Posted: 11 Aug 2019, 00:26
by LondoN eXtream
- | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
native geoip_country(const IP[], Result[], Len);
native geoip_city(const IP[], Result[], Len);
public client_putinserver(Player)
{
if(is_user_bot(Player) || is_user_hltv(Player))
return;
new Name[32], Address[16], Country[32], City[32];
get_user_name(Player, Name, charsmax(Name));
get_user_ip(Player, Address, charsmax(Address), 1);
geoip_country(Address, Country, charsmax(Country));
geoip_city(Address, City, charsmax(City));
Print(0, "Player^x04 %s^x01 connected from [^x03%s^x01][^x03%s^x01]", Name, equal(Country, "error") ? "N/A" : Country, equal(City, "error") ? "N/A" : City);
}
stock Print(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
if(id) players[0] = id;
else get_players(players, count, "ch"); {
for(new i = 0; i < count; i++) {
if(is_user_connected(players)) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
write_byte(players);
write_string(msg);
message_end();
}
}
}
}