[FilterScript] [FS] My First Admin Teleport to Player Filterscript
#1

This script should teleport to stand next to a player or join them in their vehicle if they are driving. Only works when logged in as RCON.

Код:
#define FILTERSCRIPT

#include <a_samp>

//The line below here should be just one line.
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//The line above here should be just one line.

stock strtok(const string[], &index)
{
  new length = strlen(string);
  while ((index < length) && (string[index] <= ' '))
  {
   index++;
  }

  new offset = index;
  new result[20];
  while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  {
   result[index - offset] = string[index];
   index++;
  }
  result[index - offset] = EOS;
  return result;
}

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Miniature Teleport FilterScript Mark 1.01");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
//new string[256];
//new diename[MAX_PLAYER_NAME];
  new cmd[256];
  new idx;
  cmd = strtok(cmdtext, idx);
  dcmd(tele, 4, cmdtext);
  return 0;
}

dcmd_tele(playerid, params[])
{
  if(IsPlayerAdmin(playerid)) {
    new id;
    new putmein;
    id = strval(params);
    if(id == 0) {
      id = playerid;
    }
    if (IsPlayerConnected(id)) {
      new Float:xpos;
      new Float:ypos;
      new Float:zpos;
      GetPlayerPos(id, Float:xpos, Float:ypos, Float:zpos);
      
      if(!IsPlayerInAnyVehicle(id)) {
        SetPlayerPos(playerid, xpos+1, ypos, zpos);
      }
      else{
        putmein = GetPlayerVehicleID(id);
        PutPlayerInVehicle(playerid, putmein, 1);
      }
    }
  }
  return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	  for(new i; i < GetMaxPlayers(); i++)
	  {
	    if (IsPlayerConnected(i))
	    {
	      if (IsPlayerInAnyVehicle(i))
      {
					     SetPlayerHealth(i, 0.0);
      }
     }
   }
	  return 1;
}
Reply
#2

More info..??
Reply
#3

what more is there to know. thats all it is.
Reply
#4

Nice!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)