/get coomand
#1

Hey , i need /get command with /accepttele and /declinetele ex :

Me : /get 12
Id 12 : Type /accepttele to teleport to ... or /declinetele .

I've tryed but ... didn't know how to do it .
Reply
#2

pawn Код:
OnPlayerConnect(playerid)
{
  SetPVarInt(playerid, "TeleTo", INVALID_PLAYER_ID);
}
Commands:
pawn Код:
if(strcmp(cmd, "/get", true) == 0)
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /get [playerid].");
    new string[256];
    new name[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name,sizeof(name));
    GetPlayerName(strval(tmp), name,sizeof(name));
    format(string,sizeof(string),"%s: type /accepttele to teleport to %s or /declinetele to decline.",name2, name);
    SetPVarInt(strval(tmp), "TeleTo", playerid);
    SendClientMessage(strval(tmp), COLOR_YELLOW, string);
    format(string,sizeof(string),"You asked %s to teleport to you.",name2);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    return 1;
  }
 
  if(strcmp(cmd, "/accepttele", true) == 0)
  {
    if(GetPVarInt(playerid, "TeleTo") == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED, "Nobody asked you to teleport to him."); //Fix my english
    new Float:X,Float:Y,Float:Z;
    new playerid2 = GetPVarInt(playerid,"TeleTo");
    GetPlayerPos(playerid2, X, Y, Z);
    SetPlayerPos(playerid, X, Y, Z+1);
    SetPVarInt(playerid, "TeleTo", INVALID_PLAYER_ID);
    //Add messages
    return 1;
  }
 
  if(strcmp(cmd, "/declinetele", true) == 0)
  {
    if(GetPVarInt(playerid, "TeleTo") == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED, "Nobody asked you to teleport to him."); //Fix my english
    SetPVarInt(playerid, "TeleTo", INVALID_PLAYER_ID);
    //Add messages
    return 1;
  }
Reply
#3

Thanks .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)