SA-MP Forums Archive
Problem with Teleport help.. - 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: Problem with Teleport help.. (/showthread.php?tid=246482)



Problem with Teleport help.. - GBLTeam - 04.04.2011

So i want to make a garage when you at that location to type /garazavlez and to enter in the garage i make a interrior and other thigs i make cmd but when i type /garazavlez with car i cant enter but without car can enter.. Why?

Here is cmds:

pawn Код:
if(!strcmp(cmdtext, "/garazavlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == 1)
            {
                if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0)
                {
                    if(PlayerToPoint(1.0,playerid,1222.5159,-1426.0334,13.3681))
                    {
                        SetVehiclePos(GetPlayerVehicleID(playerid), 2663.32958984,1777.94506836,1266.57214355);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
                        SetPlayerPos(playerid, 2663.32958984,1777.94506836,1266.57214355);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Prvu Garazu",5000,1);
                        SetPlayerInterior(playerid,1);
                        PlayerInfo[playerid][pInt] = 1;
                    }
                }
            }
        }
        return 1;
    }
    if(!strcmp(cmdtext, "/garazaizlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == 1)
            {
                if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0)
                {
                    if(PlayerToPoint(1.0,playerid,242.7591,66.4315,1003.6406))
                    {
                        SetVehiclePos(GetPlayerVehicleID(playerid), 1222.5159,-1426.0334,13.3681);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                        SetPlayerPos(playerid, 1222.5159,-1426.0334,13.3681);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Los Santos",5000,1);
                        SetPlayerInterior(playerid,0);
                        PlayerInfo[playerid][pInt] = 0;
                    }
                }
            }
        }
        return 1;
    }



Re: Problem with Teleport help.. - bijoyekuza - 04.04.2011

Replace
if(GetPlayerState(playerid) == 1)
at both commands
with
if(GetPlayerState(playerid) == 0)
Oh and make sure ur not a leader or something


Re: Problem with Teleport help.. - GBLTeam - 04.04.2011

ok now its like this:

pawn Код:
if(!strcmp(cmdtext, "/garazavlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
                    if(PlayerToPoint(1.0,playerid,1222.5159,-1426.0334,13.3681))
                    {
                        SetVehiclePos(GetPlayerVehicleID(playerid), 2663.32958984,1777.94506836,1266.57214355);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
                        SetPlayerPos(playerid, 2663.32958984,1777.94506836,1266.57214355);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Prvu Garazu",5000,1);
                        SetPlayerInterior(playerid,1);
                        PlayerInfo[playerid][pInt] = 1;
                    }
                }
        return 1;
    }
I type /garazavlez but i enter without my car..


Re: Problem with Teleport help.. - bijoyekuza - 04.04.2011

this is how it should look

pawn Код:
if(!strcmp(cmdtext, "/garazavlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == 0)
            {
                if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0)
                {
                    if(PlayerToPoint(1.0,playerid,1222.5159,-1426.0334,13.3681))
                    {
                        if(IsPlayerInAnyVehicle(playerid))
                        {
                        SetVehiclePos(GetPlayerVehicleID(playerid), 2663.32958984,1777.94506836,1266.57214355);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
                        SetPlayerPos(playerid, 2663.32958984,1777.94506836,1266.57214355);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Prvu Garazu",5000,1);
                        SetPlayerInterior(playerid,1);
                        PlayerInfo[playerid][pInt] = 1;
                        }else{
                        SetPlayerPos(playerid, 2663.32958984,1777.94506836,1266.57214355);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Prvu Garazu",5000,1);
                        SetPlayerInterior(playerid,1);
                        PlayerInfo[playerid][pInt] = 1;
                        }
                    }
                }
            }
        }
        return 1;
    }
    if(!strcmp(cmdtext, "/garazaizlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == 0)
            {
                if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0)
                {
                    if(PlayerToPoint(1.0,playerid,242.7591,66.4315,1003.6406))
                    {
                        if(IsPlayerInAnyVehicle(playerid))
                        {
                        SetVehiclePos(GetPlayerVehicleID(playerid), 1222.5159,-1426.0334,13.3681);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                        SetPlayerPos(playerid, 1222.5159,-1426.0334,13.3681);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Los Santos",5000,1);
                        SetPlayerInterior(playerid,0);
                        PlayerInfo[playerid][pInt] = 0;
                        }else{
                        SetPlayerPos(playerid, 1222.5159,-1426.0334,13.3681);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Los Santos",5000,1);
                        SetPlayerInterior(playerid,0);
                        PlayerInfo[playerid][pInt] = 0;
                        }
                    }
                }
            }
        }
        return 1;
    }



Re: Problem with Teleport help.. - GBLTeam - 04.04.2011

not working .. im entering in the garage withoutcar :S
But when i back to car he is (invisible) and type again /garazavlez i join with car, but i exit from it?


Re: Problem with Teleport help.. - bijoyekuza - 04.04.2011

Okey
create on the top of your script a variable
pawn Код:
new myVid[MAX_PLAYERS];
and now the commands

pawn Код:
if(!strcmp(cmdtext, "/garazavlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == 0)
            {
                if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0)
                {
                    if(PlayerToPoint(1.0,playerid,1222.5159,-1426.0334,13.3681))
                    {
                        if(IsPlayerInAnyVehicle(playerid))
                        {
                        new myVid[playerid] = GetPlayerVehicleID(playerid);
                        SetVehiclePos(GetPlayerVehicleID(playerid), 2663.32958984,1777.94506836,1266.57214355);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
                        SetPlayerPos(playerid, 2663.32958984,1777.94506836,1266.57214355);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Prvu Garazu",5000,1);
                        SetPlayerInterior(playerid,1);
                        PlayerInfo[playerid][pInt] = 1;
                        PutPlayerInVehicle(playerid,myVid[playerid]);
                        }else{
                        SetPlayerPos(playerid, 2663.32958984,1777.94506836,1266.57214355);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Prvu Garazu",5000,1);
                        SetPlayerInterior(playerid,1);
                        PlayerInfo[playerid][pInt] = 1;
                        }
                    }
                }
            }
        }
        return 1;
    }
    if(!strcmp(cmdtext, "/garazaizlez", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) == 0)
            {
                if(PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0)
                {
                    if(PlayerToPoint(1.0,playerid,242.7591,66.4315,1003.6406))
                    {
                        if(IsPlayerInAnyVehicle(playerid))
                        {
                        new myVid[playerid] = GetPlayerVehicleID(playerid);
                        SetVehiclePos(GetPlayerVehicleID(playerid), 1222.5159,-1426.0334,13.3681);
                        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                        SetPlayerPos(playerid, 1222.5159,-1426.0334,13.3681);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Los Santos",5000,1);
                        SetPlayerInterior(playerid,0);
                        PlayerInfo[playerid][pInt] = 0;
                        PutPlayerInVehicle(playerid,myVid[playerid]);
                        }else{
                        SetPlayerPos(playerid, 1222.5159,-1426.0334,13.3681);
                        GameTextForPlayer(playerid, "~w~Dobrodosli u Los Santos",5000,1);
                        SetPlayerInterior(playerid,0);
                        PlayerInfo[playerid][pInt] = 0;
                        }
                    }
                }
            }
        }
        return 1;
    }



Re: Problem with Teleport help.. - GBLTeam - 04.04.2011

pawn Код:
F:\Test1\Bsserver\gamemodes\bs.pwn(27665) : warning 219: local variable "myVid" shadows a variable at a preceding level
F:\Test1\Bsserver\gamemodes\bs.pwn(27665) : error 008: must be a constant expression; assumed zero
F:\Test1\Bsserver\gamemodes\bs.pwn(27665) : error 008: must be a constant expression; assumed zero
F:\Test1\Bsserver\gamemodes\bs.pwn(27665) : error 036: empty statement
F:\Test1\Bsserver\gamemodes\bs.pwn(27665) : fatal error 107: too many error messages on one line
Line:
pawn Код:
new myVid[playerid] = GetPlayerVehicleID(playerid);



Re: Problem with Teleport help.. - bijoyekuza - 04.04.2011

oops
at the commands
replace new myVid[playerid] = GetPlayerVehicleID(playerid);
with
myVid[playerid] = GetPlayerVehicleID(playerid);


Re: Problem with Teleport help.. - GBLTeam - 04.04.2011

pawn Код:
F:\Test1\Bsserver\gamemodes\bs.pwn(27672) : warning 202: number of arguments does not match definition
F:\Test1\Bsserver\gamemodes\bs.pwn(27704) : warning 202: number of arguments does not match definition
Line:
pawn Код:
PutPlayerInVehicle(playerid,myVid[playerid]);



Re: Problem with Teleport help.. - bijoyekuza - 04.04.2011

at both commands
replace
PutPlayerInVehicle(playerid,myVid[playerid]);
with
PutPlayerInVehicle(playerid,myVid[playerid],0);