Little Help (Rep+)
#1

pawn Код:
if(PlayerCuffed[i] == 1)
        {
            if(PlayerCuffedTime[i] <= 0)
            {
                //Frozen[i] = 0;
                SetPVarInt(i, "IsFrozen", 0);
                TogglePlayerControllable(i, 1);
                PlayerCuffed[i] = 0;
                SetPVarInt(i, "PlayerCuffed", 0);
                PlayerCuffedTime[i] = 0;
                ClearAnimations(i, 1);
                SetPlayerSkin(i, GetPlayerSkin(i));
                SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(i, X, Y, Z);
                SetPlayerPos(i, X, Y, Z);
                if(PlayerDraggedBy[i] != INVALID_PLAYER_ID) {
                    IsCopDragging[PlayerDraggedBy[i]] = INVALID_PLAYER_ID;
                    PlayerDragged[i] = 0;
                    PlayerDraggedBy[i] = INVALID_PLAYER_ID;
                }
                if(IsPlayerAttachedObjectSlotUsed(i, 0))
                    RemovePlayerAttachedObject(i, 0);
            }
            else
            {
                PlayerCuffedTime[i] -= 1;
            }
        }
        if(PlayerCuffed[i] == 2)
        {
            if(PlayerCuffedTime[i] <= 0)
            {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(i, X, Y, Z);
                new copinrange;
                foreach(new j : Player) //ERROR AT THIS LINE
                {
                    if(IsPlayerInRangeOfPoint(j, 30, X, Y, Z) && IsACop(j))
                    {
                        copinrange = 1;
                    }
                }

                if(copinrange == 0)
                {
                    //Frozen[i] = 0;
                    ClearAnimations(i, 1);
                    SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
                    DeletePVar(i, "IsFrozen");
                    GameTextForPlayer(i, "~r~You broke the cuffs, you're free!", 2500, 3);

                    if(IsPlayerAttachedObjectSlotUsed(i, 0))
                        RemovePlayerAttachedObject(i, 0);

                    TogglePlayerControllable(i, 1);
                    PlayerCuffed[i] = 0;
                    DeletePVar(i, "PlayerCuffed");
                    PlayerCuffedTime[i] = 0;
                    if(PlayerDraggedBy[i] != INVALID_PLAYER_ID) {
                        IsCopDragging[PlayerDraggedBy[i]] = INVALID_PLAYER_ID;
                        PlayerDragged[i] = 0;
                        PlayerDraggedBy[i] = INVALID_PLAYER_ID;
                    }

                    new string[76];
                    format(string, sizeof(string), "* %s has managed to wiggle out of the hand cuffs.", GetPlayerNameEx(i));
                    ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                }
                else
                {
                    PlayerCuffedTime[i] = 60;
                }
            }
            else
            {
                PlayerCuffedTime[i] -= 1;
            }
        }
PHP код:
C:\Ma Stuff is Here\FUCKU\gamemodes\LAYLrp.pwn(64568) : error 017undefined symbol "foreach"
C:\Ma Stuff is Here\FUCKU\gamemodes\LAYLrp.pwn(64568) : error 029invalid expressionassumed zero
C
:\Ma Stuff is Here\FUCKU\gamemodes\LAYLrp.pwn(64568) : error 017undefined symbol "j"
C:\Ma Stuff is Here\FUCKU\gamemodes\LAYLrp.pwn(64568) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Can anyone help me? I'll give rep+
Reply
#2

Download Foreach and put this in your include dir.
Reply
#3

Your foreach statement should be written like so I believe:
pawn Код:
foreach(Player, j) {
    if(IsPlayerInRangeOfPoint(j, 30, X, Y, Z) && IsACop(j)) {
        copinrange = 1;
    }
}
Actually, never mind. You can write it both ways. You can find the include here if you need it:
https://sampforum.blast.hk/showthread.php?tid=92679
Reply
#4

Thanks for your help, REP+ both of you
Reply
#5

seems to be that you don't have newest foreach include.
download it add add it at pawno/includes/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)