// Player's Teleport system.
// By Lordz™.
//Topic : https://sampforum.blast.hk/showthread.php?pid=2086387#pid2086387
//Author: Lordz™.
//Version:BETA v1
//Released Date: 29/08/2012
//How to use:?
//Use /teleon to enable tele command.
//Note that if you enable tele command,others will be able to teleport to you using /ptele
//teleoff to disable tele command.
//ptele to teleport to a player.
//Note that you can only teleport to other using ptele if other has enabled tele command.
//mtele to teleport to a player by spending money.
//telecmds to view commands.
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Player's teleport system loaded.");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
//============================================================================================================
//Player's Teleport system by Lordz™.
//=============================================================================================================*/
#define red 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00AA
//#define mtele
//Uncomment this to disable money goto(/mtele)
#define orange 0xFF9900AA
#define green 0x33FF33AA
new tele[MAX_PLAYERS];
CMD:gon(playerid,params[])
{
if(tele[playerid]==1)
return SendClientMessage(playerid, COLOR_YELLOW, "You've already enabled GO command. Use /goff");
tele[playerid]=1;
SendClientMessage(playerid, COLOR_YELLOW, "You've enabled tele command. Note that others can teleport to you.");
return 1;
}
CMD:goff(playerid,params[])
{
if(tele[playerid]==0)
return SendClientMessage(playerid, COLOR_YELLOW, "You've already disabled GO command. Use /gon to enable.");
tele[playerid]=0;
SendClientMessage(playerid, COLOR_YELLOW, "Your tele command has been turned off.");
return 1;
}
CMD:go(playerid,params[])
{
new teleid;
if(sscanf(params,"u",teleid)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /go [playerid]");
// if(IsPlayerConnected(teleid)) return SendClientMessage(playerid, red, "Player is not connected");
if(tele[teleid]==1) return SendClientMessage(playerid, COLOR_YELLOW, "Player has disabled GO command..");
new Float:telex,Float:teley,Float:telez,int;
GetPlayerPos(teleid,telex,teley,telez);
int = GetPlayerInterior(teleid);
SetPlayerPos(playerid,telex,teley,telez);
SetPlayerInterior(playerid,int);
return 1;
}
#if defined mtele
CMD:mtele(playerid,params[])
{
if(GetPlayerMoney(playerid)<5000) return SendClientMessage(playerid, COLOR_YELLOW, "You need $5000 to use this command.");
new target;
if(sscanf(params,"u",target)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage:/mtele [playerid]");
// if(IsPlayerConnected(target)) return SendClientMessage(playerid, red, "Player isnt connected");
GivePlayerMoney(playerid,-5000);
new Float:x,Float:y,Float:z,mint;
GetPlayerPos(target,x,y,z);
mint = GetPlayerInterior(target);
SetPlayerPos(playerid,x,y,z);
SetPlayerInterior(playerid,mint);
SendClientMessage(playerid, red, "You've successfully used /mtele using $5000.");
return 1;
}
#endif
//Hope you will enjoy the script.
// Player's Teleport system.
// By Lordz™.
//Topic : https://sampforum.blast.hk/showthread.php?pid=2086387#pid2086387
//Author: Lordz™.
//Version:BETA v1
//Released Date: 29/08/2012
//How to use:?
//Use /teleon to enable tele command.
//Note that if you enable tele command,others will be able to teleport to you using /ptele
//teleoff to disable tele command.
//ptele to teleport to a player.
//Note that you can only teleport to other using ptele if other has enabled tele command.
//mtele to teleport to a player by spending money.
//telecmds to view commands.
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Player's teleport system loaded.");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
//============================================================================================================
//Player's Teleport system by Lordz™.
//=============================================================================================================*/
#define red 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00AA
//#define mtele
//Uncomment this to disable money goto(/mtele)
#define orange 0xFF9900AA
#define green 0x33FF33AA
new tele[MAX_PLAYERS];
CMD:gon(playerid,params[])
{
if(tele[playerid]==1)
return SendClientMessage(playerid, COLOR_YELLOW, "You've already enabled GO command. Use /goff");
tele[playerid]=1;
SendClientMessage(playerid, COLOR_YELLOW, "You've enabled tele command. Note that others can teleport to you.");
return 1;
}
CMD:goff(playerid,params[])
{
if(tele[playerid]==0)
return SendClientMessage(playerid, COLOR_YELLOW, "You've already disabled GO command. Use /gon to enable.");
tele[playerid]=0;
SendClientMessage(playerid, COLOR_YELLOW, "Your tele command has been turned off.");
return 1;
}
CMD:go(playerid,params[])
{
new teleid;
if(sscanf(params,"u",teleid)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /go [playerid]");
// if(IsPlayerConnected(teleid)) return SendClientMessage(playerid, red, "Player is not connected");
if(tele[teleid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Player has disabled GO command..");
new Float:telex,Float:teley,Float:telez,int;
GetPlayerPos(teleid,telex,teley,telez);
int = GetPlayerInterior(teleid);
SetPlayerPos(playerid,telex,teley,telez);
SetPlayerInterior(playerid,int);
return 1;
}
#if defined mtele
CMD:mtele(playerid,params[])
{
if(GetPlayerMoney(playerid)<5000) return SendClientMessage(playerid, COLOR_YELLOW, "You need $5000 to use this command.");
new target;
if(sscanf(params,"u",target)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage:/mtele [playerid]");
// if(IsPlayerConnected(target)) return SendClientMessage(playerid, red, "Player isnt connected");
GivePlayerMoney(playerid,-5000);
new Float:x,Float:y,Float:z,mint;
GetPlayerPos(target,x,y,z);
mint = GetPlayerInterior(target);
SetPlayerPos(playerid,x,y,z);
SetPlayerInterior(playerid,mint);
SendClientMessage(playerid, red, "You've successfully used /mtele using $5000.");
return 1;
}
#endif
//Hope you will enjoy the script.
SendClientMessage(playerid, COLOR_YELLOW, "You've teleported to %s");
CMD:go(playerid,params[])
{
new teleid;
if(sscanf(params,"u",teleid)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /go [playerid]");
// if(IsPlayerConnected(teleid)) return SendClientMessage(playerid, red, "Player is not connected");
if(tele[teleid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Player has disabled GO command.");
new Float:telex,Float:teley,Float:telez,int;
GetPlayerPos(teleid,telex,teley,telez);
int = GetPlayerInterior(teleid);
SetPlayerPos(playerid,telex,teley,telez);
SetPlayerInterior(playerid,int);
SendClientMessage(playerid, COLOR_YELLOW, "You've teleported to %s");
return 1;
}
GetPlayerName(playerid, name, sizeof(name));
|
It now works! There's a little problem. I'm trying it out on my home server before uploading it in a new version of my hosted one.. And after I type /go 0 ( I TP to myself ) once but usually twice, my server crashes.
Sometimes the first time the teleport works, telling me "You have teleported to Zero" I just added pawn Код:
pawn Код:
Mhm.. I thought.. Do I have to add this? pawn Код:
|
CMD:go(playerid,params[])
{
new teleid;
new MSG[250];
GetPlayerName(playerid, teleid,sizeof(teleid);
if(sscanf(params,"u",teleid)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /go [playerid]");
// if(IsPlayerConnected(teleid)) return SendClientMessage(playerid, red, "Player is not connected");
if(tele[teleid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Player has disabled GO command.");
new Float:telex,Float:teley,Float:telez,int;
GetPlayerPos(teleid,telex,teley,telez);
int = GetPlayerInterior(teleid);
SetPlayerPos(playerid,telex,teley,telez);
SetPlayerInterior(playerid,int);
format(MSG,sizeof(MSG),"You've teleported to %s",teleid);
SendClientMessage(playerid, COLOR_YELLOW, MSG);
return 1;
}
GetPlayerName(playerid, teleid, sizeof(teleid);
GetPlayerName(playerid, teleid, sizeof(teleid);
if(tele[teleid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Player has disabled GO command.");
GetPlayerPos(teleid,telex,teley,telez);
int = GetPlayerInterior(teleid);
CMD:go(playerid,params[])
{
new teleid[MAX_PLAYER_NAME];
new MSG[250];
GetPlayerName(playerid, teleid, sizeof(teleid);
if(sscanf(params,"u",teleid)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /go [playerid]");
// if(IsPlayerConnected(teleid)) return SendClientMessage(playerid, red, "Player is not connected");
if(tele[teleid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Player has disabled GO command.");
new Float:telex,Float:teley,Float:telez,int;
GetPlayerPos(teleid,telex,teley,telez);
int = GetPlayerInterior(teleid);
SetPlayerPos(playerid,telex,teley,telez);
SetPlayerInterior(playerid,int);
format(MSG,sizeof(MSG),"You've teleported to %s",teleid);
SendClientMessage(playerid, COLOR_YELLOW, MSG);
return 1;
}
CMD:go( playerid, params[ ] )
{
new
teleid,
pname[ MAX_PLAYER_NAME ],
MSG[ 128 ]
;
GetPlayerName( teleid, pname, sizeof( pname ) );
if( sscanf( params, "u", teleid ) ) return SendClientMessage( playerid, COLOR_YELLOW, "Usage: /go [playerid]" );
// if( IsPlayerConnected( teleid ) ) return SendClientMessage( playerid, red, "Player is not connected" );
if( tele[ teleid ] == 0 ) return SendClientMessage( playerid, COLOR_YELLOW, "Player has disabled GO command." );
new
Float:pos[ 3 ]
;
GetPlayerPos( teleid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
SetPlayerPos( playerid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
SetPlayerInterior( playerid, GetPlayerInterior( teleid ) );
format( MSG, sizeof( MSG ), "You've teleported to %s", pname );
SendClientMessage( playerid, COLOR_YELLOW, MSG );
return 1;
}