SA-MP Forums Archive
Question for house system.. - 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)
+--- Thread: Question for house system.. (/showthread.php?tid=508551)



Question for house system.. - Galletziz - 22.04.2014

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..?


Re: Question for house system.. - MattTucker - 22.04.2014

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.


Re: Question for house system.. - Galletziz - 22.04.2014

Bump*


Re: Question for house system.. - Galletziz - 22.04.2014

Bump* no solutions з_з


Re: Question for house system.. - AiRaLoKa - 22.04.2014

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


Re: Question for house system.. - Galletziz - 22.04.2014

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..


Re: Question for house system.. - Galletziz - 22.04.2014

Bump й_и


Re: Question for house system.. - Galletziz - 22.04.2014

Bump з_з


Re: Question for house system.. - Galletziz - 22.04.2014

bumppppp*


Re: Question for house system.. - Galletziz - 23.04.2014

all programmers and nobody know the solutions..