String formating
#4

What's the point of storing the country to both PVar and variable? One would be better.

Anyways, use either:
pawn Код:
public GeoIPLookingFor( playerid, response_code, data[ ] )
{
    strmid( PlayerCountry[ playerid ], data, 9, strfind( data, "City:", false ) - 1 );
    SetPVarString( playerid, "Player_Country", PlayerCountry[ playerid ] );
    return 1;
}
Or:
pawn Код:
public GeoIPLookingFor( playerid, response_code, data[ ] )
{
    new
        sz_Country[ 32 ]
    ;
    strmid( sz_Country, data, 9, strfind( data, "City:", false ) - 1 );
    SetPVarString( playerid, "Player_Country", sz_Country );
    strcat( ( PlayerCountry[ playerid ][ 0 ] = '\0', PlayerCountry[ playerid ] ), sz_Country, 32 );
    return 1;
}
However, it might fail to show the country in-time due to the time is needed for the HTTP to get the data and call GeoIPLookingFor.
Reply


Messages In This Thread
String formating - by ajwar - 01.11.2013, 10:29
Re: String formating - by Konstantinos - 01.11.2013, 10:45
Re: String formating - by ajwar - 01.11.2013, 11:39
Re: String formating - by Konstantinos - 01.11.2013, 11:49

Forum Jump:


Users browsing this thread: 1 Guest(s)