RangeOfPoint Help please!
#1

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.
Reply
#2

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"));
            }
        }
    }
}
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)