SA-MP Forums Archive
[FilterScript] M's Teleport System - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] M's Teleport System (/showthread.php?tid=584487)



M's Click Teleport System - Fancy - 05.08.2015

M's Teleport System

In-Game Usage
Dubble click a player from scoreboard (TAB) and you will teleport to him/her.

Download
Solidfiles


Source Code

PHP код:
#include <a_samp>
#define FILTERSCRIPT
public OnFilterScriptInit()
{
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    new 
Float:xFloat:yFloat:z;
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(
GetPlayerInterior(clickedplayerid) >= 1) return SendClientMessage(playerid0xFFFFFFFF"You can teleport to a player inside an interior with a vehicle");
        if(
clickedplayerid == playerid) return 0;
        new 
str[150], vehicleid GetPlayerVehicleID(playerid);
        
GetPlayerPos(clickedplayeridxyz);
        
SetVehiclePos(vehicleidxyz);
        
LinkVehicleToInterior(vehicleidGetPlayerInterior(clickedplayerid));
        
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(clickedplayerid));
        
format(strsizeof(str),"You have teleported to %s(%d)"GetName(clickedplayerid), clickedplayerid);
        
SendClientMessage(playerid0xFFFFFFFFstr);
    }
    else
    {
        new 
str[150];
        
GetPlayerPos(clickedplayeridxyz);
        
SetPlayerPos(playeridxyz);
        
SetPlayerInterior(playeridGetPlayerInterior(clickedplayerid));
        
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(clickedplayerid));
        
format(strsizeof(str),"You have teleported to %s(%d)"GetName(clickedplayerid), clickedplayerid);
        
SendClientMessage(playerid0xFFFFFFFFstr);
    }
    return 
1;
}
stock GetName(playerid)
{
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNamesizeof(Name));
    return 
Name;




Re: M's Teleport System - SpikY_ - 05.08.2015

Nice one.


Re: M's Teleport System - LazyB0y - 05.08.2015

Good JoB!


Re: M's Teleport System - Mariciuc223 - 05.08.2015

Why do you use stock "GetName" ? You can simple get player name in OnPlayerClickPlayer ..


Re: M's Teleport System - Fancy - 05.08.2015

Quote:
Originally Posted by Mariciuc223
Посмотреть сообщение
Why do you use stock "GetName" ? You can simple get player name in OnPlayerClickPlayer ..
Stocks make it quicker to script in big scripts.As you are new to scripting so you dont know everything