/switch
#1

Okay, I need this one command set, ive tried to write it a few times but failed. heres what i want to do. i dont know how to use the floats.

/switch id

allow player to /switch places with another player.

i think the only exception would be if player is in vehicle.
only TEAM_AGENT can use this command

please help this is my last command to add to release my version on a perm server.
Reply
#2

ok heres what i got so far, but it only take you to the player, i need it to take the player back to where he WAS.

also, he cant do this on TEAM_AGENT , TEAM_NEO, TEAM_SMITH

Code:
	if(strcmp(cmd, "/switch", true == 0) && gTeam[playerid] == TEAM_AGENT )
	{
	tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /switch (id)");
  return 1;
  }
  giveplayerid = strval(tmp);

  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /switch (id) ID Must be a number");
  return 1;
  }
  if (IsPlayerConnected(giveplayerid)) {
  SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
  new Float:x, Float:y, Float:z;
  new pname[24];
  new aname[24];
  GetPlayerPos(giveplayerid, x,y,z);
  SetPlayerPos(playerid, x+1,y,z);
  GetPlayerName(giveplayerid, pname, 24);
  GetPlayerName(playerid, aname, 24);
  SendClientMessage(playerid, 0xA9A9A9AA, "|_Special Ability Used_|");
  format(string, sizeof(string), "You have teleported to %s(%d)",pname,giveplayerid);
  SendClientMessage(playerid,0xFF7F50AA, string);
  format(string, sizeof(string), "%s(%d) has teleported to %s(%d) [ABILITY COMMAND /SWITCH]",aname,playerid,pname,giveplayerid);
  printf("%s", string);
  }
  else {
  format(string, sizeof(string), "ID (%d) Is not an active player", giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  }
  return 1;
  }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)