[FilterScript] Teleporting (to) players
#1

With this filterscript you can teleport to players or teleport them to you, vehicles the players are in are also teleported. The commands require the player to be logged in as an (RCON) admin to work.

..:: How it works ::.

/get [playerid]
With this you teleport the player with [playerid] to yourself
/tele [playerid]
With this you teleport to with [playerid]
..:: The code ::..

pawn Код:
#include <a_samp>
#include "../include/gl_common.inc"

#define FILTERSCRIPT

#define COLOR_WHITE 0xFFFFFFFF

public OnPlayerCommandText(playerid, cmdtext[])
{
    new idx;
    new cmd[256];

    cmd = strtok(cmdtext, idx);

    if(strcmp("/tele", cmd, true) == 0)
    {
     if(IsPlayerAdmin(playerid)) {
            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;
        }
        else{
            SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are not authorized to use this command.");
            return 1;
        }
    }
    if(strcmp("/get", cmd, true) == 0)
    {
     if(IsPlayerAdmin(playerid)) {
            new tmp[256], player, Float:X, Float:Y, Float:Z, carid, seat;
            tmp = strtok(cmdtext, idx);
            player = strval(tmp);
            GetPlayerPos(playerid, X, Y, Z);
            if(IsPlayerInAnyVehicle(player)){
                carid = GetPlayerVehicleID(player);
                seat = GetPlayerVehicleSeat(player);
                SetVehiclePos(carid, X+1, Y, Z);
                PutPlayerInVehicle(player, carid, seat);
                return 1;
            }
            SetPlayerPos(player, X+1, Y, Z);
            return 1;
        }
        else{
            SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are not authorized to use this command.");
            return 1;
        }
    }
    return 0;
}
Enjoy.
Reply
#2

Bad string sizes.. bad system.. bad optimization.. A sscanf2 and zcmd utilization would be good..
Reply
#3

Simple and nice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)