teleports - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: teleports (
/showthread.php?tid=64394)
teleports -
StrickenKid - 03.02.2009
im am now currently adding some tele cmds for my admins script, but i am having some trobble..
i am wondering iof this code will work to tele to another player:
Код:
if((strcmp(cmdtext, "/teleto", true, 5)== 0))
{
if(!strlen(cmdtext[6]))
{
SendClientMessage(playerid, 0xFF0000AA, "Use: /teleto [playerid]");
return 1;
}
new toid = strval(cmdtext[6]);
new pName[24], str[64];
if(IsPlayerConnected(toid))
{
GetPlayerName(toid, pName, 24);
SendClientMessage(playerid, 0xFF0000AA, "Teleported");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(toid,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
}
return 1;
}
and just switching some things arround to tele them to me:
Код:
if((strcmp(cmdtext, "/teleto", true, 5)== 0))
{
if(!strlen(cmdtext[6]))
{
SendClientMessage(playerid, 0xFF0000AA, "Use: /teletome [playerid]");
return 1;
}
new fromid = strval(cmdtext[6]);
new pName[24], str[64];
if(IsPlayerConnected(fromid))
{
GetPlayerName(fromid, pName, 24);
SendClientMessage(playerid, 0xFF0000AA, "Teleported");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(fromid,X,Y,Z);
}
return 1;
}
that pretty much it! look over it and tell me if it looks right!
Re: teleports -
sidhu123 - 04.02.2009
Why don't you try it :P
Re: teleports -
Auto-Sized - 04.02.2009
You may also need to factor in interiors and virtual worlds etc.