Teleport cmd
#1

Quick question:
when l create a map with MTA that is making "CreateObject".
I create the teleport cmd to go to that map but I dont know where to put that cmd in the GM.
Can someone help pls?
Reply
#2

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

here is an example :

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/teleport", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, changeme);
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
change the "change me" to the co of ur map hope this helps
Reply
#4

ty
Reply
#5

Quote:
Originally Posted by thefatshizms
Посмотреть сообщение
here is an example :

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/teleport", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, changeme);
        return 1;
    }
    return 0;
}
change the "change me" to the co of ur map hope this helps
Yeah he is right. You can try to explain a bit more fatshizms. But good work. instead of changeme write the co-ordinates like x, y, z.
Reply
#6

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Yeah he is right. You can try to explain a bit more fatshizms. But good work. instead of changeme write the co-ordinates like x, y, z.
yeh soz
Reply
#7

Thanks it sure helped
Reply
#8

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/teleport", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, changeme);
return 1;
}
return 0;
}
Is it souse to go like this?
Reply
#9

Quote:
Originally Posted by Spike Cena
Посмотреть сообщение
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/teleport", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, changeme);
return 1;
}
return 0;
}
Is it souse to go like this?
btw use [ PAWN ] and [ /PAWN ] without spaces when posting code

u need to change the "changeme" to the x,y,z pos of ur map so i suggest u go ingame (ofc loading the map in the server first) then doing /save map go to your samp folder and saved positions which should be in your gta userfiles and get the x,y,z for e.g

say i have already done the save part i go to my saved positions and find the code which should look something like this:

AddStaticVehicle(555,-1773.7599,1205.3926,24.8102,358.0844,58,1); // map
note: THIS IS ONLY EXAMPLE !
the numbers i have made bold r the numbers which u have to replace the changeme with
(again this is example use r own saved pos or ur come to what ever pos i put here )
Reply
#10

Quote:
Originally Posted by Spike Cena
Посмотреть сообщение
pawn Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/teleport", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, changeme);
        return 1;
    }
    return 0;
}
Is it souse to go like this?
Yeah it is supposed to be this way. Just follow thefatshizms way he will explain u with further problems.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)