SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 27/04/2011, 05:05 PM   #1
Anteino
Big Clucker
 
Join Date: Dec 2010
Posts: 138
Reputation: 2
Default Teleporting (to) players

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 Code:
#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.
__________________
Let's solve problems!
Anteino is offline   Reply With Quote
Old 27/04/2011, 06:37 PM   #2
admantis
High-roller
 
Join Date: Sep 2009
Posts: 2,524
Reputation: 449
Default Re: Teleporting (to) players

Bad string sizes.. bad system.. bad optimization.. A sscanf2 and zcmd utilization would be good..
admantis is offline   Reply With Quote
Old 28/04/2011, 05:09 AM   #3
Millionaire
Banned
 
Join Date: Apr 2011
Location: Los Santos => Groove Street
Posts: 226
Reputation: 10
Default Re: Teleporting (to) players

Simple and nice
Millionaire is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Teleporting yoan103 Help Archive 4 03/03/2011 04:51 PM
[HELP]Teleporting players in order.. LasTRace Help Archive 1 07/08/2010 08:06 PM
Teleporting bug potato Help Archive 2 20/01/2010 05:30 PM
Teleporting with car Mechscape Help Archive 6 15/11/2009 01:21 PM


All times are GMT. The time now is 10:26 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.