04.02.2013, 14:41
/pgoto allows to goto other players.only if the tele is on./tele will switch on tele on/off
with sscanf+zcmd plz.
with sscanf+zcmd plz.
new teleon[MAX_PLAYERS]
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tele", cmdtext, true) == 0)
{
if(tele == 0)
{
tele = 1;
SendClientMessage(playerid, -1, "Tele is enabled now");
}
else
{
tele = 0;
SendClientMessage(playerid, -1, "Tele is disabled now");
}
return 1;
}
if (strcmp("/pgoto", cmdtext, true) == 0)
{
if(tele == 0)
{
SendClientMessage(playerid, -1, "ERROR: Tele is disabled!");
}
else
{
new tmp[256], player, Float:X, Float:Y, Float:Z, carid, seat;
tmp = strtok(cmdtext, idx);
player = strval(tmp);
GetPlayerPos(player, X, Y, Z);
if(IsPlayerInAnyVehicle(playerid))
{
carid = GetPlayerVehicleID(playerid);
seat = GetPlayerVehicleSeat(playerid);
SetVehiclePos(carid, X+1, Y, Z);
PutPlayerInVehicle(playerid, carid, seat);
return 1;
}
SetPlayerPos(playerid, X+1, Y, Z);
}
return 1;
}
return 0;
}
CMD:teleportto(playerid, params[])
{
if( !IsPlayerAdmin( playerid ))
return SendClientMessage( playerid, 0xFF0000FF, "[ERROR] Only RCON admins can use this command." );
if( isnull( params ))
return SendClientMessage( playerid, 0xFFFF00FF, "[USAGE] /teleport [target id] - teleports you to the player." );
new
iTarget = strval( params ),
Float: fPos[ 3 ]
;
GetPlayerPos( iTarget, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SetPlayerPos( playerid, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SendClientMessage( playerid, 0x00FF00FF, "[SUCCESS] You've been teleported to the specified player" );
return true;
}
//taken from y_utils - a part of the YSI package by ******
#if !defined isnull
#define isnull(%1) \
((%1[0] == 0) || (%1[0] == 1 && %1[1] == 0))
#endif
new teleon[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tele", cmdtext, true) == 0)
{
if(tele == 0)
{
tele = 1;
SendClientMessage(playerid, -1, "Tele is enabled now");
}
else
{
tele = 0;
SendClientMessage(playerid, -1, "Tele is disabled now");
}
return 1;
}
if (strcmp("/pgoto", cmdtext, true) == 0)
{
if(tele == 0)
{
SendClientMessage(playerid, -1, "ERROR: Tele is disabled!");
}
else
{
new tmp[256], player, Float:X, Float:Y, Float:Z, carid, seat;
tmp = strtok(cmdtext, idx);
player = strval(tmp);
GetPlayerPos(player, X, Y, Z);
if(IsPlayerInAnyVehicle(playerid))
{
carid = GetPlayerVehicleID(playerid);
seat = GetPlayerVehicleSeat(playerid);
SetVehiclePos(carid, X+1, Y, Z);
PutPlayerInVehicle(playerid, carid, seat);
return 1;
}
SetPlayerPos(playerid, X+1, Y, Z);
}
return 1;
}
return 0;
}