SA-MP Forums Archive
GetPlayerCity ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerCity ? (/showthread.php?tid=268799)



GetPlayerCity ? - Julian12345 - 13.07.2011

Hello

How to get the city name of a player? (LS, SF, LV)

I always get zone names like Idlewood, Jefferson, Mulholland, etc...


Re: GetPlayerCity ? - Ironboy - 13.07.2011

This will help you
http://forum.sa-mp.com/showthread.ph...ighlight=geoip


Re: GetPlayerCity ? - [MG]Dimi - 13.07.2011

I think he meant on Ingame cities. Not real life cities. xD


AW: Re: GetPlayerCity ? - Julian12345 - 13.07.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
I think he meant on Ingame cities. Not real life cities. xD
Yup^^


Re: GetPlayerCity ? - Ironboy - 13.07.2011

lol i thought real :P


Re: GetPlayerCity ? - [MG]Dimi - 13.07.2011

xD
Well try making zones and then when someone uses command or for whatever reason you want this use zone detection(dont know function but it exsists)


AW: Re: GetPlayerCity ? - Julian12345 - 13.07.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
xD
Well try making zones and then when someone uses command or for whatever reason you want this use zone detection(dont know function but it exsists)
Well I have these zones, but it only shows the zone name (Ex: Mulholland), not city..


AW: GetPlayerCity ? - Julian12345 - 14.07.2011

Bump


Re: GetPlayerCity ? - Jay. - 14.07.2011

find all the area for each city(SF, LV, LS) then check if they are in the area with a command , you should know the rest... Julianorp


Re: GetPlayerCity ? - Adil - 14.07.2011

pawn Код:
new Float:Cities[][CityInfo] = {
{ "Los Santos",                     44.60, -2892.90,  -242.90,  2997.00,  -768.00,   900.00},
{ "Las Venturas",                  869.40,   596.30,  -242.90,  2997.00,  2993.80,   900.00},
{ "San Fierro",                  -2997.40, -1115.50,  -242.90, -1213.90,  1659.60,   900.00}
pawn Код:
//Don't add this if you're already having something to get zones like idlewood or w/e. Just replace it.
enum CityInfo
{
    zone_name[30],
    Float:zone_minx,
    Float:zone_miny,
    Float:zone_minz,
    Float:zone_maxx,
    Float:zone_maxy,
    Float:zone_maxz
}
pawn Код:
stock GetPlayerCity(playerid)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    for(new i=0;i<sizeof(Zones);i++)
    {
        if(x > Zones[i][zone_minx] && y > Zones[i][zone_miny] && z > Zones[i][zone_minz] && x < Zones[i][zone_maxx] && y < Zones[i][zone_maxy] && z < Zones[i][zone_maxz])
        return i;
    }
    return false;
}