12.10.2013, 08:57
Alright pretty much when a LEO trys to /drag a suspect it comes up with " This player is already being dragged " I've quickly made a video and it's uploading to explain a-tad more.
pawn Код:
new pDrag[MAX_PLAYERS];
new pDragging[MAX_PLAYERS];
new pDragTimer[MAX_PLAYERS];
CMD:drag(playerid, params[])
{
new gid;
if((IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12) && GetPVarInt(playerid, "IsInArena") < 0 && !GetPVarInt(playerid, "EventToken") && PlayerInfo[playerid][pJailed] == 0 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pDivision] == 1)
{
if(sscanf(params,"u",gid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [PlayerID/PartOfName]");
if(!IsPlayerConnected(gid)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected.");
if(playerid == gid) return SendClientMessage(playerid, COLOR_WHITE, "You cannot drag yourself. Sigh.");
if(PlayerCuffed[gid] == 2)
{
if(pDrag[gid] == -1 && pDragging[playerid] == -1)
{
TogglePlayerControllable(gid, 0);
pDrag[gid] = playerid;
pDragging[playerid] = gid;
new str[128];
format(str, 128,"* %s has started dragging %s from his cuffs.", GetPlayerNameEx(playerid), GetPlayerNameEx(gid));
ProxDetector(30.0, playerid, str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
pDragTimer[playerid]=SetTimerEx("Drag", 1000, 1, "i", gid);
return 1;
}
else
{
if(pDrag[gid] != -1) return SendClientMessage(playerid, COLOR_WHITE, "That player is already being dragged.");
if(pDragging[playerid] != -1) return SendClientMessage(playerid, COLOR_WHITE, "You are already dragging someone else.");
}
}
else
{
return SendClientMessage(playerid, COLOR_WHITE, "That player is not cuffed.");
}
}
return SendClientMessage(playerid, COLOR_WHITE, "You are not a Law Enforcement Officer.");
}
CMD:stopdrag(playerid, params[])
{
if((IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12) && GetPVarInt(playerid, "IsInArena") < 0 && !GetPVarInt(playerid, "EventToken") && PlayerInfo[playerid][pJailed] == 0 || PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pDivision] == 1)
{
if(pDragging[playerid] != -1)
{
new str[128];
format(str, 128,"* %s has let loose of %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(pDragging[playerid]));
ProxDetector(30.0, playerid, str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TogglePlayerControllable(pDragging[playerid], 1);
KillTimer(pDragTimer[playerid]);
pDrag[pDragging[playerid]] = -1;
pDragging[playerid] = -1;
return 1;
}
return SendClientMessage(playerid, COLOR_WHITE, "You are not dragging anyone.");
}
return SendClientMessage(playerid, COLOR_WHITE, "You are not a Law Enforcement Officer.");
}
CMD:undrag(playerid, params[])
{
new id;
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command.");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE:/undrag [PlayerID]");
if(IsPlayerConnected(id) && pDrag[id] != -1)
{
pDragging[pDrag[id]] = -1;
KillTimer(pDragTimer[pDrag[id]]);
TogglePlayerControllable(id, 1);
pDrag[id] = -1;
new str[128];
format(str, 128, "AdmCmd: %s has undragged %s (ID: %i).", GetPlayerNameEx(playerid), GetPlayerNameEx(id), id);
ABroadCast(COLOR_ORANGE, str, 2);
return 1;
}
return SendClientMessage(playerid, COLOR_WHITE, "That ID is not being dragged.");
}
forward Drag(pid1);
public Drag(pid1)
{
if(IsPlayerConnected(pid1) && IsPlayerConnected(pDrag[pid1]))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(pDrag[pid1],X,Y,Z);
SetPlayerPos(pid1,X,Y,Z);
return 1;
}
else
{
KillTimer(pDragTimer[pDrag[pid1]]);
return 1;
}
}