enum CopDrag // Group variables for copdrag.
{
Cop, // If this group variable is set to 1 that means the cop is dragging someone.
Crim, // If this group variable is set it means the criminal is being dragged.
CopPlayer[MAX_PLAYERS], // This is sets a variable on the cop to the id of the player they are dragging.
CrimPlayer[MAX_PLAYERS], // This sets a variable on the criminal to the id of the cop that is dragging them.
};
new Drag[MAX_PLAYERS][CopDrag];
DragStop(copid, crimid)
{
Drag[copid][Cop] = 0;
Drag[crimid][Crim] = 0;
Drag[copid][CopPlayer] = INVALID_PLAYER_ID;
Drag[crimid][CrimPlayer] = INVALID_PLAYER_ID;
KillTimer(DragTimer[crimid]);
}
CMD:unfreeze(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
if(IsPlayerConnected(giveplayerid))
{
DeletePVar(giveplayerid, "IsFrozen");
TogglePlayerControllable(giveplayerid, 1);
DragStop(Drag[giveplayerid][CrimPlayer], giveplayerid); // Script stops here!
format(string, sizeof(string), "AdmCmd: %s was unfrozen by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Invalid player specified.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
CMD:unfreeze(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
if(IsPlayerConnected(giveplayerid))
{
DeletePVar(giveplayerid, "IsFrozen");
TogglePlayerControllable(giveplayerid, 1);
Drag[Drag[giveplayerid][CrimPlayer]][Cop] = 0;
Drag[giveplayerid][Crim] = 0;
Drag[giveplayerid][CopPlayer] = INVALID_PLAYER_ID;
Drag[Drag[giveplayerid][CopPlayer]][CrimPlayer] = INVALID_PLAYER_ID;
KillTimer(DragTimer[Drag[giveplayerid][CrimPlayer]]);
format(string, sizeof(string), "AdmCmd: %s was unfrozen by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Invalid player specified.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
DragStop(copid, crimid)
{
SendClientMessageToAll(0x00FF00FF, "Started");
Drag[copid][Cop] = 0;
SendClientMessageToAll(0xFFFFFFFF, "1");
Drag[crimid][Crim] = 0;
SendClientMessageToAll(0xFFFFFFFF, "2");
Drag[copid][CopPlayer] = INVALID_PLAYER_ID;
SendClientMessageToAll(0xFFFFFFFF, "3");
Drag[crimid][CrimPlayer] = INVALID_PLAYER_ID;
SendClientMessageToAll(0xFFFFFFFF, "4");
KillTimer(DragTimer[crimid]);
SendClientMessageToAll(0x00FF00FF, "Finished");
}
Change your function to the one below, and it will tell you where it fails.
pawn Код:
|
Drag[giveplayerid][CrimPlayer]
Ah... after taking a closer look at it, the problem looks to be that you're using
pawn Код:
|