/get coomand
#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


Messages In This Thread
/get coomand - by Rock18 - 02.03.2011, 19:21
Re: /get coomand - by Sasino97 - 02.03.2011, 19:48
Re: /get coomand - by Rock18 - 02.03.2011, 20:05

Forum Jump:


Users browsing this thread: 1 Guest(s)