TelePlayer Command.
#1

Hello, Can some one tell me how to script a /teleplayer command?
Reply
#2

Plese!
Reply
#3

I think this will help you

pawn Код:
if(strcmp(cmd, "/teleplayer", true) == 0)   {
    if(PlayerInfo[playerid][Level] >= 3) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))    {
            SendClientMessage(playerid, red, "USAGE: /teleplayer [playerid] to [playerid]");
            return 1;   }
        new player1;
        player1 = strval(tmp);
        if(!IsPlayerConnected(player1) || player1 == INVALID_PLAYER_ID)     {
            SendClientMessage(playerid,red,"ERROR: Player is not connected");
            return 1;       }
        tmp = strtok(cmdtext, idx);

        new player2;
        player2 = strval(tmp);
        if(!IsPlayerConnected(player1) || player2 == INVALID_PLAYER_ID)     {
            SendClientMessage(playerid,red,"ERROR: Player is not connected");
            return 1;       }
        tmp = strtok(cmdtext, idx);

        new Float:plocx,Float:plocy,Float:plocz;
        GetPlayerPos(player2, plocx, plocy, plocz); new intid = GetPlayerInterior(player2); SetPlayerInterior(player1,intid);
        SetPlayerVirtualWorld(player1,GetPlayerVirtualWorld(player2));
        CMDMessageToAdmins(playerid,"TELEPLAYER");
        if (GetPlayerState(player1) == 2)
        {
        new VehicleID = GetPlayerVehicleID(player1);
        SetVehiclePos(VehicleID, plocx, plocy+4, plocz);   LinkVehicleToInterior(VehicleID,intid);
        SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(player2) );
        } else  {
        SetPlayerPos(player1,plocx,plocy+2, plocz);     }
    } else  {
    SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");   }
    return 1;   }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)