Teleport command help! [REp+1] - 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: Teleport command help! [REp+1] (
/showthread.php?tid=319173)
Teleport command help! [REp+1] -
ProdrifterX - 18.02.2012
Hello guys.
i need help with some teleport cmd i got cmd /startevent and it works perfect it shows
Administrator [name] has started an event /join
and i need help, when you type /join teleports to admin who started event
how to do that?
help me pls, today is event on my server!
thanks
REP +1
_________________
IP :
188.40.57.132:7777
Drift - Generation
Re: Teleport command help! [REp+1] -
Twisted_Insane - 18.02.2012
Hey! This is usually called "goto-command" and has got the same function! So it is available for every player?
PHP код:
CMD:join(playerid, params[])
{
new ID;
new Float:x, Float:y, Float:z;
// GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z); //Forget the X-Y-Z, type your own co-ords into here!
return 1;
}
Re: Teleport command help! [REp+1] -
ReneG - 18.02.2012
You would first need to make global variables, you can't define them in one function!
I wrote this very quick. It is a MERE example. Don't copy/paste as it might not work.
pawn Код:
new
Float:eventX, //These are the variables that will hold the even info.
Float:eventY,
Float:eventZ
eventInterior,
eventVirtualWorld;
new
Event = 0; //This is basically a bool.
CMD:startevent(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) //This command is for RCON Admins only.
{
SendClientMessage(playerid,0xFFFFFFFF,"You are not an admin.");
return 1;
}
if(Event = 1) //If an event has been started, this will show.
{
SendClientMessage(playerid,0xFFFFFFFF,"An event has already been started.");
return 1;
}
else
{
new //Defines variables for the Admin's name and string that will be sent to everyone."
AdminName[MAX_PLAYER_NAME],
eventstring[128];
GetPlayerName(playerid,AdminName,sizeof(MAX_PLAYER_NAME)); //This formats the string.
format(string,sizeof(string),"Administrator %s has started an event! Use /joinevent to enter!",AdminName);
SendClientMessageToAll(0xFFFFFFFF,string); //Send everyone the string.
Event = 1; //Says that an event has been started.
GetPlayerPos(playerid,eventX,eventY,eventZ); //These things below sets the event information to the Admin's position.
GetPlayerInterior(playerid,eventInterior);
GetPlayerVirtualWorld(playerid,eventVirtualWorld);
return 1;
}
}
CMD:joinevent(playerid,params[])
{
if(Event == 0) //If no event is not started, then do this.
{
SendClientMessage(playerid,0xFFFFFFFF,"An event has not been started.");
return 1;
}
else
{
SetPlayerPos(playerid,eventX,eventY,eventZ); //This sets the player's position ot the event start.
SetPlayerVirtualWorld(playerid,eventVirtualWorld);
SetPlayerInterior(playerid,eventInterior);
return 1;
}
}