nedd help wit script that allows a player to teleport to another player
#1

i only started pawn yesterday and i need to add the abilaty for a player to teleport to another player

any help would be apresheated, figman
Reply
#2

http://pastebin.com/d59b552ef
Reply
#3

Thank you
Reply
#4

when i put the cade in i get these error messages:

Код:
C:\Documents and Settings\Steve\Desktop\samp02Xserver.win32\gamemodes\Parkour.pwn(136) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Steve\Desktop\samp02Xserver.win32\gamemodes\Parkour.pwn(140) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Steve\Desktop\samp02Xserver.win32\gamemodes\Parkour.pwn(140) : warning 215: expression has no effect
C:\Documents and Settings\Steve\Desktop\samp02Xserver.win32\gamemodes\Parkour.pwn(140) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Steve\Desktop\samp02Xserver.win32\gamemodes\Parkour.pwn(140) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steve\Desktop\samp02Xserver.win32\gamemodes\Parkour.pwn(140) : fatal error 107: too many error messages on one line
ts probablysommthing i did wrong

heres my script:
Код:
#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT

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

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Parkour");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(204, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(123, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(147, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(192, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(121, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(190, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(115, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(211, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(124, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(254, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(202, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(181, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(19, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(28, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(179, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(122, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(108, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(110, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(93, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(193, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddStaticVehicle(424, 2351.0303, 1501.3264, 42.8203, 85.8817, 0, 0);
 	AddStaticVehicle(424, 2351.9304, 1494.6304, 42.8203, 89.9550, 0, 0);
 	AddStaticVehicle(424, 2352.2107, 1487.5167, 42.8203, 91.2084, 0, 0);
	AddStaticVehicle(424, 2352.1499, 1480.2135, 42.8203, 97.1618, 0, 0);
	AddStaticVehicle(424, 2351.8083, 1472.8422, 42.8156, 90.5817, 0, 0);
	AddStaticVehicle(563, 2316.2476, 1461.6284, 42.8203, 183.9325, 0, 1);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 2078.9006,1170.9474,10.8203);
	SetPlayerCameraPos(playerid, 2074.7644,1172.1974,10.6719);
	SetPlayerCameraLookAt(playerid, 2078.9006,1170.9474,10.8203);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	new string[256];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string, sizeof(string), "Welcome to Parkour Forever %s", playername);
	SendClientMessage(playerid, 0xAA3333AA, string);
	return 1;
}

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

public OnPlayerSpawn(playerid)
{
  SetPlayerPos(playerid, 2354.2573,1506.3003,42.8203);
	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 OnPlayerPrivmsg(playerid, recieverid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

    if(strcmp(cmd, "/teleport", true) == 0)

    {

        if (PlayerInfo[playerid][pAdmin] >= 3)

        {

            tmp = strtok(cmdtext, idx);

            if(!strlen(tmp))

            {

                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /teleport [playername/id] [targetname/id]");

                return 1;

            }

            giveplayerid = ReturnUser(tmp);

            if(giveplayerid != INVALID_PLAYER_ID)

            {

              tmp = strtok(cmdtext, idx);

                if(!strlen(tmp))

                {

                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /teleport [playername/id] [targetname/id]");

                    return 1;

                }

                new targetid = ReturnUser(tmp, playerid);

                if (targetid == INVALID_PLAYER_ID)

                {

                  SendClientMessage(playerid,COLOR_WHITE, OFF_TEXT);

                  return 1;

                }

              new Float:tX,Float:tY,Float:tZ;

              if (GetPlayerState(giveplayerid) == PLAYER_STATE_DRIVER)

              {

                GetPlayerPos(targetid,tX,tY,tZ);

                SetVehiclePos(GetPlayerVehicleID(giveplayerid),tX,tY,tZ+2);

                }

                else

                {

                GetPlayerPos(targetid,tX,tY,tZ);

                SetPlayerPos(giveplayerid,tX,tY,tZ+2);

              }

              SetPlayerInterior(giveplayerid,GetPlayerInterior(targetid));

            }

            else if(giveplayerid == INVALID_PLAYER_ID)

            {

                format(string, sizeof(string), "%d is not an active player.", giveplayerid);

                SendClientMessage(playerid, COLOR_WHITE, string);

            }

        }

        else

        {

            SendClientMessage(playerid, COLOR_WHITE,ADMIN_TEXT);

            return 1;

        }
}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

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 OnObjectMoved(objectid)
{
	return 1;
}

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

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

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

public OnPlayerExitedMenu(playerid)
{
	return 1;
}
Reply
#5

Quote:
Originally Posted by MoroJr™
Why not just
UP:
pawn Код:
#define COLOR_ORANGERED 0xFF4500AA
OnPlayerCommandText:
pawn Код:
if(strcmp(cmd, "/goto", true) == 0)

    tmp = strtok(cmdtext, idx);

    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ORANGERED, "[Usage]: /goto [ID]");
    return 1;
    }
    alarmid = strval(tmp);
    if(!IsPlayerConnected(alarmid)){
    SendClientMessage(playerid, COLOR_ORANGERED, "[Error]: Player is not connected!");
    return 1;
    }
    GetPlayerName(alarmid, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
  format(string, sizeof(string), "[Sprбva] Player [ %s ] teleported to player [ %s ].", sendername,giveplayer);
  SendClientMessageToAll(COLOR_ORANGERED, string);
    //SendClientMessageToAll(COLOR_ORANGERED, string);
    Interior = GetPlayerInterior(alarmid);
    SetPlayerInterior(playerid,Interior);
    GetPlayerPos(alarmid,Float:X, Float:Y, Float:Z);
    SetPlayerPos(playerid,Float:X, Float:Y, Float:Z);
    return 1;
    }
Reply
#6

http://pastebin.com/f4bd14fdb
Reply
#7

Thanks for all help
still not got it to work though i will work it out eventualy
jus need sort out errors if posibble couls someone add it to tyhe code i have alredy got and re post it
because i cant get it to work i am probably being a compleate idiot
Код:
#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT

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

public OnFilterScriptExit()
{
	return 1;
}

#else
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2
main()
{
	print("\n----------------------------------");
	print("Parkou Forever by figman");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Parkour");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(204, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(123, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(147, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(192, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(121, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(190, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(115, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(211, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(124, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(254, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(202, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(181, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(19, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(28, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(179, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(122, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(108, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(110, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(93, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddPlayerClass(193, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 	AddStaticVehicle(424, 2351.0303, 1501.3264, 42.8203, 85.8817, 0, 0);
 	AddStaticVehicle(424, 2351.9304, 1494.6304, 42.8203, 89.9550, 0, 0);
 	AddStaticVehicle(424, 2352.2107, 1487.5167, 42.8203, 91.2084, 0, 0);
	AddStaticVehicle(424, 2352.1499, 1480.2135, 42.8203, 97.1618, 0, 0);
	AddStaticVehicle(424, 2351.8083, 1472.8422, 42.8156, 90.5817, 0, 0);
	AddStaticVehicle(563, 2316.2476, 1461.6284, 42.8203, 183.9325, 0, 1);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 2078.9006,1170.9474,10.8203);
	SetPlayerCameraPos(playerid, 2074.7644,1172.1974,10.6719);
	SetPlayerCameraLookAt(playerid, 2078.9006,1170.9474,10.8203);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	new string[256];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string, sizeof(string), "Welcome to Parkour Forever %s", playername);
	SendClientMessage(playerid, 0xAA3333AA, string);
	return 1;
}

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

public OnPlayerSpawn(playerid)
{
  SetPlayerPos(playerid, 2354.2573,1506.3003,42.8203);
	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 OnPlayerPrivmsg(playerid, recieverid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
 
{
	dcmd(goto, 4, cmdtext);
	return 1;
}
public OnPlayerInfoChange(playerid)
{
	return 1;
}

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 OnObjectMoved(objectid)
{
	return 1;
}

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

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

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

public OnPlayerExitedMenu(playerid)
{
	return 1;
}
thankyou
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)