Question for house system..
#1

Hay dudes, You probably think that i am the person with the most problems in the world regarding pawn, I scripted a house system, but when I create more homes, and go into the one that does not belong to me but with the door open, if the interior of this is the same to a other when I give the command /exit my player spawns at the exit of another house with the same interior.

/join command

pawn Код:
CMD:join(playerid,params[])
{
    for(new i = 0; i < MAX_CASE; i++)
    {
        new nome[34];
        GetPlayerName(playerid,nome,sizeof(nome));
        if(!IsPlayerInRangeOfPoint(playerid,3.5,cinfo[i][entrataX],cinfo[i][entrataY],cinfo[i][entrataZ])) continue;
        if(cinfo[i][acquisita] == 0) return SendClientMessage(playerid,-1,"[SERVER] This house isn't owned, so you can't join in!");
        if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome)==0)
        {
            SetPlayerInterior(playerid,cinfo[i][interior]);
            SetPlayerPos(playerid,cinfo[i][uscitaX],cinfo[i][uscitaY],cinfo[i][uscitaZ]);
            SetPlayerVirtualWorld(playerid,0);
        }
        if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome)==1 && cinfo[i][chiusa] == 1)
        {
            SendClientMessage(playerid,-1,"[SERVER] You can't join, this house is closed");
        }
        else
        {
            SetPlayerInterior(playerid,cinfo[i][interior]);
            SetPlayerPos(playerid,cinfo[i][uscitaX],cinfo[i][uscitaY],cinfo[i][uscitaZ]);
            SetPlayerVirtualWorld(playerid,0);
        }
    }
    return 1;
}
exit command

pawn Код:
for(new i = 0; i < MAX_CASE; i++)
    {
        for(new j = 0; j < MAX_PLAYERS; j++)
        {
            if(!IsPlayerInRangeOfPoint(j,3.5,cinfo[i][uscitaX],cinfo[i][uscitaY],cinfo[i][uscitaZ])) continue;
            SetPlayerInterior(j,0);
            SetPlayerPos(j,cinfo[i][entrataX],cinfo[i][entrataY],cinfo[i][entrataZ]);
            SetPlayerVirtualWorld(j,0);
            return 1;
        }
    }
    return 1;
I tryed to use SetPVarFloat for store the enter coords so when player give a command /exit he spawn in side enter coords.

so i tryed like this:

pawn Код:
SetPVarFloat(playerid,"entercoords",GetPlayerPos(playerid,x,y,z));
But i can't apply it in SetPlayerPos function, so how doing for solve..?
Reply
#2

Why don't you create a variable for storing the house ID that he guy entered, and when he exits, instead of using a loop you can use SetPlayerPos(playerid,cinfo[*name of the variable*][entrataX].... etc

If you don't get it, I can try scripting it for you.
Reply
#3

Bump*
Reply
#4

Bump* no solutions з_з
Reply
#5

why do you use loop if there is only one person who enter and exit from the house?
Reply
#6

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
why do you use loop if there is only one person who enter and exit from the house?
Only in exit command i use loop for players and you right, it not needed, but the problem isn't this.. My problem is that i want that when a player join in an house whit a same interior of other, when he type /exit, he spawn in a same side where he had joined, without using checkpoints or pickups..
Reply
#7

Bump й_и
Reply
#8

Bump з_з
Reply
#9

bumppppp*
Reply
#10

all programmers and nobody know the solutions..
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)