Need help with teleports
#1

Hey there

I got jak's gamemode of dm/rp etc and I tried to edit it , read follow the pawn code od /sfa command

PHP код:
CMD:sfa(playeridparams[])
{
    
SpawnCheck(playerid);
    
PassengerCheck(playerid);
    if(
Restriction(playerid) == 1)
    {
        
SendClientMessage(playerid, -1"» "red"You cannot use this command at the moment.");
        return 
1;
    }
    
SetCameraBehindPlayer(playerid);
    if(
IsPlayerInAnyVehicle(playerid))
    {
        
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0);
        
SetVehiclePos(GetPlayerVehicleID(playerid), -1504.4640,-322.4451,6.7357);
        
SetVehicleZAngle(GetPlayerVehicleID(playerid), 13.3832);
    }
    else
    {
        
SetPlayerInterior(playerid0);
        
SetPlayerVirtualWorld(playerid0);
        
SetPlayerPos(playerid, -1514.8895,-331.4654,6.8848);
        
SetPlayerFacingAngle(playerid359.1662);
    }
    
SendTeleportMessage(playerid"San Fierro Airport""sfa");
    return 
1;

Can someone explain me how to make some other commands like ls,lva,sf,lsa with the above code?

Thanks and do not judge me I am just a new scripter
Reply
#2

Hi,

Regarding your code, if you want to make a teleport command, you will need just to change the following lines:

pawn Код:
CMD:sfa(playerid, params[])
{
    SpawnCheck(playerid);
    PassengerCheck(playerid);
    if(Restriction(playerid) == 1) return SendClientMessage(playerid, -1, "» "red"You cannot use this command at the moment.");
         
    if(IsPlayerInAnyVehicle(playerid))
    {
    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0);
    SetVehiclePos(GetPlayerVehicleID(playerid), -1504.4640, -322.4451, 6.7357); // Change this line
    SetVehicleZAngle(GetPlayerVehicleID(playerid), 13.3832);  // Optional
    }
    else
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerPos(playerid, -1514.8895,-331.4654,6.8848); // Change this line
    SetPlayerFacingAngle(playerid, 359.1662); // Optional
    }
    SendTeleportMessage(playerid, "San Fierro Airport", "sfa");
    SetCameraBehindPlayer(playerid);    
    return 1;
}
I have made some changes in your code, but it will do the same thing.
You could just to make another command like that and change the lines I have mentioned.

To get a position coordinate, type /save in game and go to your GTA-SA files > SAMP and look for a file named "savedpositions" and get the second, third and fourth paramter of the function "AddPlayerClass".

More info:

https://sampwiki.blast.hk/wiki/AddPlayerClass
Reply
#3

Check This One: https://sampforum.blast.hk/showthread.php?tid=517866
Reply
#4

Thanks man for helping , REP+

EDIT: Commands are not working I get errors when I put some of commands in my gamemode
Reply
#5

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Thanks man for helping , REP+

EDIT: Commands are not working I get errors when I put some of commands in my gamemode
Where are you putting them?

Show your code and errors, please.
Reply
#6

Here is the compile errors

PHP код:
C:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6706) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6709) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6720) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6722) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6723) : error 017undefined symbol "TeleportMessages"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


1 Error

Reply
#7

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Here is the compile errors

PHP код:
C:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6706) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6709) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6720) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6722) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6723) : error 017undefined symbol "TeleportMessages"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Reply
#8

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Here is the compile errors

PHP код:
C:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6706) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6709) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6720) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6722) : warning 217loose indentation
C
:\Users\Nikos\Desktop\Server\Agamemode\gamemodes\blank.pwn(6723) : error 017undefined symbol "TeleportMessages"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

About the warning lines, just organize the lines mentioned, they are without good indentation.
About the error line, just delete this line (6723) and your code should works.
Reply
#9

Thanks you all guys for your support , I wish I could do something more to reward you but I only can REP+

I will try to fix all the errors
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)