error 028: invalid subscript (not an array or too many subscripts): "KillTimer" -
maramizo - 22.07.2012
As title says, "error 028: invalid subscript (not an array or too many subscripts): "KillTimer" "
Код:
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;
}
}
Quick help is appreciated.
Re: error 028: invalid subscript (not an array or too many subscripts): "KillTimer" -
Rudy_ - 22.07.2012
You made a timer? show it
Re: error 028: invalid subscript (not an array or too many subscripts): "KillTimer" -
maramizo - 22.07.2012
pawn Код:
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.");
}
Obvious enough error is not from the timer.
Re: error 028: invalid subscript (not an array or too many subscripts): "KillTimer" -
[KHK]Khalid - 22.07.2012
You can not use
KillTimer (Click me for info) like that. More like: (?)
pawn Код:
KillTimer([pDragTimer[pDrag[pid1]]]);
Or just like in your stopdrag command
pawn Код:
KillTimer(pDragTimer[pid1]); // it was KillTimer(pDragTimer[playerid]);
Re: error 028: invalid subscript (not an array or too many subscripts): "KillTimer" -
maramizo - 22.07.2012
Fixed.
It was
pawn Код:
KillTimer([pDragTimer[pid1]]);
Instead of
pawn Код:
KillTimer(pDragTimer[pid1]);
.