SA-MP Forums Archive
/get coomand - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /get coomand (/showthread.php?tid=233939)



/get coomand - Rock18 - 02.03.2011

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 .


Re: /get coomand - Sasino97 - 02.03.2011

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;
  }



Re: /get coomand - Rock18 - 02.03.2011

Thanks .