SA-MP Forums Archive
HOW TO TELEPORT WITH Cars - 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: HOW TO TELEPORT WITH Cars (/showthread.php?tid=514753)



HOW TO TELEPORT WITH Cars - DIVESHSEET - 23.05.2014

how to teleport with cars using /teleport DIALOG ::

PNW CODE::::


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid ==0)
{
if(response)
switch(listitem)
{
case 0: SetPlayerPos(playerid,1539.5408,1848.2786,12.141 ;
case 1: SetPlayerPos(playerid,1528.0547,1279.0752,12.3336) ;
case 2: SetPlayerPos(playerid,1991.2944,-2458.9768,13.5469);
case 3: SetPlayerPos(playerid,324.9410,2535.1624,25.4971);
case 4: SetPlayerPos(playerid,1544.4052,-1353.3448,329.4742);
case 5: SetPlayerPos(playerid,2644.7524,-2027.3654,13.5469);
case 6: SetPlayerPos(playerid,1042.1637,-1036.5790,31.7509);
}
}
return 1;
}


Re: HOW TO TELEPORT WITH Cars - amirab - 23.05.2014

for each list item before SetPlayerPos use this :

PHP код:
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), XYZ



Re: HOW TO TELEPORT WITH Cars - DIVESHSEET - 23.05.2014

4ERRORS


C:\Users\SEETANEEA\Desktop\kailash&div&ritesh songs\MUSIC FROM DESKTOP\!SAMP 3Z!\gamemodes\LVAATWAR.pwn(279 : error 002: only a single statement (or expression) can follow each "case"
C:\Users\SEETANEEA\Desktop\kailash&div&ritesh songs\MUSIC FROM DESKTOP\!SAMP 3Z!\gamemodes\LVAATWAR.pwn(279 : error 001: expected token: ";", but found "-identifier-"
C:\Users\SEETANEEA\Desktop\kailash&div&ritesh songs\MUSIC FROM DESKTOP\!SAMP 3Z!\gamemodes\LVAATWAR.pwn(279 : error 017: undefined symbol "X"
C:\Users\SEETANEEA\Desktop\kailash&div&ritesh songs\MUSIC FROM DESKTOP\!SAMP 3Z!\gamemodes\LVAATWAR.pwn(279 : fatal error 107: too many error messages on one line


Re: HOW TO TELEPORT WITH Cars - Diverse - 23.05.2014

Ooh god... Try this for every single case statement. But be aware that the X Y Z differs from the other cases.

pawn Код:
case 0:
{
     if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), 1539.5408,1848.2786,12.141);
     SetPlayerPos(playerid,1539.5408,1848.2786,12.141);
}



Re: HOW TO TELEPORT WITH Cars - DIVESHSEET - 23.05.2014

SetPlayerPos(playerid,324.9410,2535.1624,25.4971); = expression has no effect
ONE ERROR


Re: HOW TO TELEPORT WITH Cars - Diverse - 23.05.2014

pawn Код:
case 0:
{
     if(IsPlayerInAnyVehicle(playerid))
     {
          SetVehiclePos(GetPlayerVehicleID(playerid), 1539.5408,1848.2786,12.141);
     }
     SetPlayerPos(playerid,1539.5408,1848.2786,12.141);
}
I like doing it this way so that it looks better and it's pretty organized


Re: HOW TO TELEPORT WITH Cars - DIVESHSEET - 23.05.2014

THANKS MAN +REP


Re: HOW TO TELEPORT WITH Cars - Diverse - 23.05.2014

Quote:
Originally Posted by DIVESHSEET
Посмотреть сообщение
THANKS MAN +REP
No problemo! That's what the Scripting Help thread is for :P


Re: HOW TO TELEPORT WITH Cars - Rittik - 23.05.2014

Here you go..... I think this code will help you out.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid ==0)
{
if(response)
switch(listitem)
{
case 0:if(IsPlayerInAnyVehicle(playerid)==1)
           {
            if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,1539.5408,1848.2786,12.141);
            SetVehiclePos(GetPlayerVehicleID(playerid),1539.5408,1848.2786,12.141);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,1539.5408,1848.2786,12.141);
             }

case 1: SetPlayerPos(playerid,1528.0547,1279.0752,12.3336) ;
           if(IsPlayerInAnyVehicle(playerid)==1)
           {
            if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,1528.0547,1279.0752,12.3336);
            SetVehiclePos(GetPlayerVehicleID(playerid),1528.0547,1279.0752,12.3336);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,1528.0547,1279.0752,12.3336);
             }

case 2:  if(IsPlayerInAnyVehicle(playerid)==1)
           {
            if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,1991.2944,-2458.9768,13.5469);
            SetVehiclePos(GetPlayerVehicleID(playerid),1991.2944,-2458.9768,13.5469);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,1991.2944,-2458.9768,13.5469);
             }

case 3: if(IsPlayerInAnyVehicle(playerid)==1)
           {
            if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,324.9410,2535.1624,25.4971);
            SetVehiclePos(GetPlayerVehicleID(playerid),324.9410,2535.1624,25.4971);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,324.9410,2535.1624,25.4971);
             }

case 4: if(IsPlayerInAnyVehicle(playerid)==1)
           {
             if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,1544.4052,-1353.3448,329.4742);
            SetVehiclePos(GetPlayerVehicleID(playerid),1544.4052,-1353.3448,329.4742);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,1544.4052,-1353.3448,329.4742);
             }

case 5:  if(IsPlayerInAnyVehicle(playerid)==1)
           {
            if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,2644.7524,-2027.3654,13.5469);
            SetVehiclePos(GetPlayerVehicleID(playerid),2644.7524,-2027.3654,13.5469);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,2644.7524,-2027.3654,13.5469);
             }

case 6: if(IsPlayerInAnyVehicle(playerid)==1)
           {
            if(GetPlayerState(playerid)==2)
            {
            SetPlayerPos(playerid,1042.1637,-1036.5790,31.7509);
            SetVehiclePos(GetPlayerVehicleID(playerid),1042.1637,-1036.5790,31.7509);
            PutPlayerInVehicle(playerid,GetVehicleID(playerid),0);
            }
            }
            else
            {
             SetPlayerPos(playerid,1042.1637,-1036.5790,31.7509);
             }

}
}
return 1;
}