Everyone can enter
#1

Hello all,
I used the house tutorial from [HiC]TheKiller,
but I tried to make a version with pickups, so allot of things are different,
now my problem is, i made an enter command, and it works but
the user shouldn't be able to enter the house if it isn't his/her house..
and i can enter a house that isn't mine so =s
please help me? =D

pawn Код:
CMD:enter(playerid, params)
{
        for(new x; x < houseid; x++)
        {
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
            if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2])) {
                if(!strcmp(pname, House[x][owner][0])) {
                    SetPlayerPos(playerid, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2]);
                    SetPlayerInterior(playerid, House[x][interiors]);
                    SetPlayerVirtualWorld(playerid, 15500000 + x);
                } else {
                    SendClientMessage(playerid, COLOR_RED, "This house is not yours!");
            }
            }
            if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2])) {
                    SetPlayerPos(playerid, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2]);
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                    return 1;
            }
        }
        return 1;
}
Reply
#2

idk your whole code but i gess that in the [owner] would not have [0]

pawn Код:
CMD:enter(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    for(new x; x < houseid; x++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2]))
        {
            if(!strcmp(pname, House[x][owner],false))
            {
                SetPlayerPos(playerid, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2]);
                SetPlayerInterior(playerid, House[x][interiors]);
                SetPlayerVirtualWorld(playerid, 15500000 + x);
            }
            else return SendClientMessage(playerid, COLOR_RED, "This house is not yours!");
        }
        if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2]))
        {
            SetPlayerPos(playerid, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
        }
    }
    return 1;
}
try this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)