SA-MP Forums Archive
Scripting problems with a game mode - 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: Scripting problems with a game mode (/showthread.php?tid=220108)



Scripting problems with a game mode - ifly4life - 03.02.2011

Ok well i wanna make a /enter cmd for more than one building, i know how to get them into the buliding and set the interior. But i cant get making /enter more than 1, i get it to compile but only one of the enters work so can someone show me a good example of multiple /enter's. thanks much guys!


Re: Scripting problems with a game mode - Krx17 - 03.02.2011

Use IsPlayerInRangeOfPoint.
pawn Код:
if(strcmp(cmdtext, "/enter", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 3, building1x, building1y, building1z))
    {
        //Teleport to building 1
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3, building2x, building2y, building2z))
    {
        //Teleport to building 2
    }
    return 1;
}



Re: Scripting problems with a game mode - [L3th4l] - 03.02.2011

pawn Код:
enum BINFO
{
    BInt,
    Float:BPosX,
    Float:BPosY,
    Float:BPosZ,
    Float:BIntX,
    Float:BIntY,
    Float:BIntZ,
};
new Buildings[][BINFO] = {
    // Interior, Entrancex, Entrancey, Entrancez, Interiorx, Interiory, Interiorz
    {0, 555.55, 555.55, 555.55, 666.66, 666.66, 666.66},
    {1, 111.11, 111.11, 111.11, 222.22, 222.22, 22.22}
    };

CMD:enter(playerid, params[])
{
    for(new i = 0; i < sizeof(Buildings); ++i)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10, Buildings[i][BPosX], Buildings[i][BPosY], Buildings[i][BPosZ]))
        {
            SetPlayerPos(playerid, Buildings[i][BIntX], Buildings[i][BIntY], Buildings[i][BIntZ]);
            SetPlayerInterior(playerid, Buildings[i][BInt]);
        }
    }
    return 1;
}