Need a function
#1

Hello, SA-MP scripter

I need a function to check the City of the player .
Like : CheckCity(playerid)
and it return 0 :Los Santos , 1 : San Fierro , 2 : Las Vegas .




Thanks
Reply
#2

This will help you:
https://sampforum.blast.hk/showthread.php?tid=166545
Reply
#3

I made this ages ago:

pawn Код:
stock CreateCityBorder(city)
{
    if(AREA_curCity != -1) DestroyDynamicArea(AREA_curCity);
    AREA_curCity = -1;
    switch(city)
    {
        case CITY_LS: // Los Santos
        {
            new Float:cityPolygon[] = {
            2972.00, -2972.00,
            187.00, -2978.67,
            89.00, -2040.67,
            89.00, -2040.67,
            5.00, -1578.67,
            -331.00, -616.67,
            -1031.00, -262.67,
            -1059.00, 101.32,
            -737.00, 339.32,
            963.62, 585.32,
            1140.62, 641.32,
            2168.15, 543.32,
            2980.15, 529.32,
            2974.57, -2972.00
            };

            AREA_curCity = CreateDynamicPolygon(cityPolygon);
        }
        case CITY_SF: // San Fierro
        {
            new Float:cityPolygon[] = {
            -3000.0, -3000.0,
            864.00, -2958.00,
            66.00, -1964.00,
            92.00, -1530.32,
            -326.00, -316.32,
            -326.00, -316.32,
            -970.00, -316.32,
            -1026.00, -260.32,
            -1026.00, -260.32,
            -816.00, 195.67,
            -648.00, 565.67,
            -886.00, 663.67,
            -1040.00, 1055.67,
            -1250.00, 1593.67,
            -1712.00, 1747.67,
            -1964.00, 2162.67,
            -2216.00, 2986.00,
            -2944.00, 2986.00,
            -3000.0, -3000.0
            };

            AREA_curCity = CreateDynamicPolygon(cityPolygon);
        }
        case CITY_LV: // San Fierro
        {
            new Float:cityPolygon[] = {
            2958.00, 2958.00,
            -2953.60, 2958.00,
            -2953.60, 2006.00,
            -1679.60, 1656.00,
            -1679.60, 1656.00,
            -1497.60, 1488.00,
            -1497.60, 1488.00,
            -1287.60, 1194.00,
            -1287.60, 1194.00,
            -993.60, 634.00,
            -553.26, 292.00,
            118.73, 124.00,
            566.73, 348.00,
            1317.73, 489.00,
            1793.73, 405.00,
            2468.00, 372.00,
            2972.00, 344.00,
            2972.00, 2967.56
            };

            AREA_curCity = CreateDynamicPolygon(cityPolygon);
        }
    }
    return 1;
}


It uses Incognito's streamer's dynamic areas, but you could adapt it to not use that.

NOTE: I made Bayside part of both SF AND LV because it's sort of both. Technically it's LV, but people more often associate it with SF.
Reply
#4

Thank You , But how to use it ? i enter the pos of the player , THX !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)