new Dragged[MAX_PLAYERS]; new IsDragged[MAX_PLAYERS]; //Longer down at the public's public Dragging(playerid,giveplayerid) { new Float:X1, Float:Y1, Float:Z1, Float:A1; GetPlayerFacingAngle(playerid,A1); GetPlayerPos(playerid,X1,Y1,Z1); SetPlayerInterior(giveplayerid,GetPlayerInterior(playerid)); SetPlayerFacingAngle(giveplayerid,A1+180); SetPlayerPos(giveplayerid,X1,Y1+2,Z1); TogglePlayerControllable(giveplayerid,0); return 1; }
if (!strcmp(cmd, "/drag", true)) { if(gTeam[playerid] == 2 || IsACop(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xFF0000AA, "/drag [playerid]"); return 1; } giveplayerid = ReturnUser(tmp); if(!IsNumeric(tmp)) { SendClientMessage(playerid,COLOR_RED, "/drag [playerid] Playerid must be a number!"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 3) { SendClientMessage(playerid, 0xFF0000AA, "You are too far away from that player."); return 1; } if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!"); return 1; } if(Dragged[giveplayerid] == 0) { GetPlayerName(giveplayerid, sendername, sizeof(sendername)); GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "Officer %s started dragging %s", playername, sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); TogglePlayerControllable(giveplayerid,0); Dragged[giveplayerid] = 1; IsDragged[playerid] = SetTimerEx("Dragging", 1000, true, "i", giveplayerid); } else { SendClientMessage(playerid, 0xFF0000AA, "This player is already being dragged"); } } else { format(string, sizeof(string), "%d is not an active player.", giveplayerid); SendClientMessage(playerid,0xFF0000AA, string); } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / Marine !"); } return 1; }
new DragTimer[MAX_PLAYERS]; forward Drag(draggerid, playerid);
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 }
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)); } }
forward Drag(giveplayerid, playerid); new DragTimer[MAX_PLAYERS];
public Drag(giveplayerid, playerid) { new Float:x, Float:y, Float:z; GetPlayerPos(giveplayerid, x, y, z); SetPlayerPos(playerid, x, y, z + 2); SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid)); }
if (strcmp(cmd, "/drag", true) == 0) { if(gTeam[playerid] == 2 || IsACop(playerid)) { tmp = strtok(cmdtext, idx); giveplayerid = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid]"); return 1; } if(!IsPlayerConnected(giveplayerid)) { format(string, sizeof(string), "%d is not an active player.", giveplayerid); SendClientMessage(playerid,COLOR_GREY, string); return 1; } if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 3) { SendClientMessage(playerid, 0xFF0000AA, "You are too far away from that player."); return 1; } if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!"); return 1; } if(DragTimer[playerid] <= 0) { if(IsPlayerConnected(giveplayerid) == 1) { GetPlayerName(giveplayerid, sendername, sizeof(sendername)); GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "Officer %s started dragging %s", playername, sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); DragTimer[playerid] = SetTimerEx("Drag", 2000, 1, "ii", giveplayerid, playerid); return 1; } } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / Marine !"); } return 1; } if (strcmp(cmd, "/stopdrag", true) == 0) { if(gTeam[playerid] == 2 || IsACop(playerid)) { if(DragTimer[playerid] >= 0) { KillTimer(DragTimer[playerid]); DragTimer[playerid] = 0; return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / Marine !"); } return 1; }
Originally Posted by Blt950
I did heavy modification because of many leaks and brackets shit.
|
DragTimer[playerid] = SetTimerEx("Drag", 2000, 1, "ii", draggedid, playerid);
DragTimer[playerid] = SetTimerEx("Drag", 2000, 1, "ii",playerid, draggedid);