SA-MP Forums Archive
Little Help (Rep+) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little Help (Rep+) (/showthread.php?tid=488637)



Little Help (Rep+) - Wayland - 18.01.2014

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+


Re: Little Help (Rep+) - Dolby - 18.01.2014

Download Foreach and put this in your include dir.


Re: Little Help (Rep+) - InglewoodRoleplay - 18.01.2014

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


Re: Little Help (Rep+) - Wayland - 18.01.2014

Thanks for your help, REP+ both of you


Re: Little Help (Rep+) - M3HR4N - 18.01.2014

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