Scripting problems with a game mode
#1

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!
Reply
#2

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;
}
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)