[SOLVED] /drag
#8

Put this at the top of your script:

Код:
new DragTimer[MAX_PLAYERS];

forward Drag(draggerid, playerid);
Put this in OnPlayerCommandText:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     new cmd[30];
     new tmp[30];
     new idx;
     cmd = strtok(cmdtext, idx);

     if(strcmp(cmd, "/drag", false)==0)
     {
         if(DragTimer[playerid] < 0)
         {
              tmp = strtok(cmdtext, idx);
              new draggedid = strval(tmp);
              if(IsPlayerConnected(draggedid) == 1)
             {       
                  DragTimer[playerid] = SetTimerEx("Drag", 2000, 1, "ii", draggedid, playerid);
                  return 1;
             }
        }
     }
     if(strcmp(cmd, "/undrag", false) == 0)
     {
         if(DragTimer[playerid] >= 0)
         {
         KillTimer(DragTimer[playerid]);
         DragTimer[playerid] = 0;
         return 1;
         }
     }
     return 0
}
Put this anywhere in your script:

Код:
public Drag(draggerid, playerid)
{
     new Float:x, Float:y, Float:z;
     GetPlayerPos(draggerid, x, y, z);
     SetPlayerPos(playerid, x, y, z + 2);
     SetPlayerInterior(playerid, GetPlayerInterior(draggerid));
}
}
Not tested and I'm not 100% sure what will happen if more than one person drags. Also I've not added any messages so you might want to.
Reply


Messages In This Thread
[SOLVED] /drag - by Blt950 - 22.05.2009, 10:50
Re: /drag - by Blt950 - 05.06.2009, 23:08
Re: /drag - by KeyWay - 05.06.2009, 23:17
Re: /drag - by Warmonger - 06.06.2009, 01:33
Re: /drag - by gemadon - 06.06.2009, 05:08
Re: /drag - by xXiamCr4zyXx - 06.06.2009, 08:48
Re: /drag - by Blt950 - 06.06.2009, 09:23
Re: /drag - by lol2112 - 06.06.2009, 09:40
Re: /drag - by Blt950 - 06.06.2009, 11:02
Re: /drag - by lol2112 - 06.06.2009, 11:26

Forum Jump:


Users browsing this thread: 1 Guest(s)