Teleport another player. -
keujh - 03.04.2010
Hiya, i was wondering if someone could help me do this.
Make a /ptele "playerid" location cmd. like if i typed in /ptele jail 1 it would teleport the selected player to the cords specified below. it's going to be used as an admin command, but all i need is the teleport function to be able to do this.
pawn Код:
AddPlayerClass(0,2652.8525,2732.3157,10.8203,89.0835,0,0,0,0,0,0); // jail 1
AddPlayerClass(0,2651.7405,2740.2009,10.8203,88.3367,0,0,0,0,0,0); // jail 2
AddPlayerClass(0,2651.8157,2747.2590,10.8203,88.3367,0,0,0,0,0,0); // jail 3
AddPlayerClass(0,2652.1021,2763.5928,10.8203,86.0963,0,0,0,0,0,0); // jail 4
AddPlayerClass(0,2652.6233,2771.3794,10.8203,92.0706,0,0,0,0,0,0); // jail 5
AddPlayerClass(0,2652.4812,2778.7742,10.8203,90.5770,0,0,0,0,0,0); // jail 6
Re: Teleport another player. -
Naxix - 03.04.2010
I don't know how to make it like the /ptele id location, but i can make the normal cmd
Код:
dcmd(ptele1,6,cmdtext);
Код:
dcmd_ptele1(playerid,params[])
{
new pid;
if(IsPlayerAdmin(playerid));
else if(params,"u",pid)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /ptele1 [ID]");
else if(pid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOUR_RED,"Inactive player id");
else
{
new name[MAX_PLAYER_NAME],string[128];
GetPlayerName(pid,name,sizeof(name));
format(string,sizeof(string),"%s has been sent to Jail 1!",name);
SendClientMessageToAll(COLOUR_RED,string);
SetPlayerPos(playerid,2652.8525,2732.3157,10.8203);
return 1;
}
}
And just do that 4 more times :b But i don't know if you can use this tho.
Re: Teleport another player. -
keujh - 03.04.2010
Well, I got the code in my script, but i get errors when trying to compile it.
The code.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/help", true) == 0)
{
SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++HELP MENU++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "Player Commands /pcmds");
SendClientMessage(playerid, COLOR_RED, "General Commands /gcmds");
SendClientMessage(playerid, COLOR_RED, "Objective /jobs");
SendClientMessage(playerid, COLOR_RED, "Vehicles & Weapons /vw");
SendClientMessage(playerid, COLOR_RED, "Administrator Commands /acmds");
return 1;
}
if(strcmp(cmdtext, "/suicide", true) == 0)
{ SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_RED, "You have commited suicide.");
return 1;
}
if(strcmp(cmdtext, "/pcmds", true) == 0)
{ SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++Player Commands++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "/suicide - Kill yourself.");
return 1;
}
if(strcmp(cmdtext, "/gcmds", true) == 0)
{ SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++General Commands++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "/stats - shows you your current stats.");
return 1;
}
if(strcmp(cmdtext, "/stats", true) == 0)
{ SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++Stats++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "-Name-");
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s ", name );
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_RED, "-Money-");
format(string, sizeof(string), "You Have $%i.", GetPlayerMoney(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
dcmd_ptele1(playerid,params[])
{
new pid;
if(IsPlayerAdmin(playerid));
else if(params,"u",pid)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /ptele1 [ID]");
else if(pid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOUR_RED,"Inactive player id");
else
{
new name[MAX_PLAYER_NAME],string[128];
GetPlayerName(pid,name,sizeof(name));
format(string,sizeof(string),"%s has been sent to Jail 1!",name);
SendClientMessageToAll(COLOUR_RED,string);
SetPlayerPos(playerid,2652.8525,2732.3157,10.8203);
return 1;
}
}
if(strcmp(cmdtext, "/vw", true) == 0)
{
if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "Vehicle Spawned!");
else SendClientMessage(playerid, COLOR_RED, "You must be logged into RCON to use this command.");
return 1;
}
return 0;
}
The Error.
pawn Код:
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(216) : error 017: undefined symbol "dcmd_ptele1"
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(219) : error 036: empty statement
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(220) : error 017: undefined symbol "params"
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(220) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(220) : warning 215: expression has no effect
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(220) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(220) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
6 Errors.
Re: Teleport another player. -
Naxix - 03.04.2010
add:
Код:
{
dcmd(ptele1,6,cmdtext);
return 0;
}
on top under OnPlayerCommand
and add:
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
at top of your script
Re: Teleport another player. -
keujh - 03.04.2010
alrighty, this sorta works.. but now there's warnings, and none of my commands work.
Added code
pawn Код:
dcmd_ptele1(playerid,params[])
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/help", true) == 0)
{
SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++HELP MENU++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "Player Commands /pcmds");
SendClientMessage(playerid, COLOR_RED, "General Commands /gcmds");
SendClientMessage(playerid, COLOR_RED, "Objective /jobs");
SendClientMessage(playerid, COLOR_RED, "Vehicles & Weapons /vw");
SendClientMessage(playerid, COLOR_RED, "Administrator Commands /acmds");
return 1;
}
if(strcmp(cmdtext, "/suicide", true) == 0)
{ SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_RED, "You have commited suicide.");
return 1;
}
if(strcmp(cmdtext, "/pcmds", true) == 0)
{ SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++Player Commands++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "/suicide - Kill yourself.");
return 1;
}
if(strcmp(cmdtext, "/gcmds", true) == 0)
{ SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++General Commands++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "/stats - shows you your current stats.");
return 1;
}
if(strcmp(cmdtext, "/stats", true) == 0)
{ SendClientMessage(playerid, COLOR_BLUE, "++++++++++++++++++++++Stats++++++++++++++++++++++");
SendClientMessage(playerid, COLOR_RED, "-Name-");
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s ", name );
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_RED, "-Money-");
format(string, sizeof(string), "You Have $%i.", GetPlayerMoney(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
{
dcmd(ptele1,6,cmdtext);
return 0;
}
new pid;
if(IsPlayerAdmin(playerid));
else if(params,"u",pid)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /ptele1 [ID]");
else if(pid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOUR_RED,"Inactive player id");
else
{
new name[MAX_PLAYER_NAME],string[128];
GetPlayerName(pid,name,sizeof(name));
format(string,sizeof(string),"%s has been sent to Jail 1!",name);
SendClientMessageToAll(COLOUR_RED,string);
SetPlayerPos(playerid,2652.8525,2732.3157,10.8203);
return 1;
}
}
if(strcmp(cmdtext, "/vw", true) == 0)
{
if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "Vehicle Spawned!");
else SendClientMessage(playerid, COLOR_RED, "You must be logged into RCON to use this command.");
return 1;
}
return 0;
}
Warnings
pawn Код:
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(383) : warning 203: symbol is never used: "OnPlayerCommandText"
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(383) : warning 203: symbol is never used: "dcmd_ptele1"
C:\Documents and Settings\Skellyhand\Desktop\gtaserver\gamemodes\Untitled.pwn(383) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Warnings.