SA-MP Forums Archive
RangeOfPoint Help please! - 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: RangeOfPoint Help please! (/showthread.php?tid=493902)



RangeOfPoint Help please! - wakeuptomer - 10.02.2014

hey guys im trying to make a /duty and in the case 2 I'm want that who is using this command in this case is must be at the range of the point but im getting some errors.

pawn Код:
case 2:
        {
            switch(GetPVarInt(playerid, "Duty"))
            {
               if(IsPlayerInRangeOfPoint(playerid,5.0,255.3855,76.9823,1003.6406))
               {
                    case 0:
                    {
                       SetPVarInt(playerid, "Duty", 1);
                       SendClientMessage(playerid,COLOR_WHITE,"You are not On-Duty.");
                       SendClientMessage(playerid,COLOR_WHITE,"/fbiskin to change your skin for your undercover position.");
                    }
                    case 1:
                    {
                       SetPVarInt(playerid, "Duty", 0);
                       SendClientMessage(playerid,COLOR_WHITE,"You are now Off-Duty.");
                       SetPlayerSkinEx(playerid, GetPVarInt(playerid, "Model"));
                    }
               }
           }
        }
Command.pwn(10869) : error 002: only a single statement (or expression) can follow each "case"
Command.pwn(10869 -- 10870) : error 028: invalid subscript (not an array or too many subscripts): "IsPlayerInRangeOfPoint"
Command.pwn(10869 -- 10871) : error 001: expected token: "}", but found "case"
Command.pwn(10869 -- 10871) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Re: RangeOfPoint Help please! - Konstantinos - 10.02.2014

Inside switch, you can only have case and default. Any other is invalid.

pawn Код:
case 2:
{
    if(IsPlayerInRangeOfPoint(playerid,5.0,255.3855,76.9823,1003.6406))
    {
        switch(GetPVarInt(playerid, "Duty"))
        {
            case 0:
            {
                SetPVarInt(playerid, "Duty", 1);
                SendClientMessage(playerid,COLOR_WHITE,"You are not On-Duty.");
                SendClientMessage(playerid,COLOR_WHITE,"/fbiskin to change your skin for your undercover position.");
            }
            case 1:
            {
                SetPVarInt(playerid, "Duty", 0);
                SendClientMessage(playerid,COLOR_WHITE,"You are now Off-Duty.");
                SetPlayerSkinEx(playerid, GetPVarInt(playerid, "Model"));
            }
        }
    }
}



Re: RangeOfPoint Help please! - wakeuptomer - 10.02.2014

thank you very much.!
I didn't think about that!.