SA-MP Forums Archive
Have I misplaced a bracket or something? - 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: Have I misplaced a bracket or something? (/showthread.php?tid=368471)



Have I misplaced a bracket or something? - Luke_James - 13.08.2012

I'm having an issue with a command I wrote, whenever I type /medicuniform at the uniform spot it says "You are not part of the SD-EMS", but it should allow me to equip the uniforms...

pawn Код:
CMD:medicuniformtest(playerid, params[])
{
    if(PlayerInfo[playerid][pMember] == 3)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a part of SD-EMS!!");
        return 1;
    }
    else if(!OnMedicDuty[playerid])
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You are not on duty!");
        return 1;
    }
    else if(!IsPlayerInRangeOfPoint(playerid, 3.0, 255.3,77.4,1003.6) && !IsPlayerInRangeOfPoint(playerid, 3.0, -1616.1294,681.1594,7.1875) && !IsPlayerInRangeOfPoint(playerid, 10.0, 228.40, 111.00, 1003.21))
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in the locker room!");
        return 1;
    }
    new skin;
    new string[128];
    if(PlayerInfo[playerid][pMember] == 3)
    {
        if(!sscanf(params, "i", skin))
        {
            switch(skin)
            {
                case 0:
                {
                    format(string,sizeof(string), "* %s puts %s medical uniform back in the locker.", PlayerNameEx(playerid), HisHer(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
                }
                case 1:
                {
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s gets on a medical uniform.", PlayerNameEx(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
                case 2:
                {
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s gets on a medical uniform.", PlayerNameEx(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
                case 3:
                {
                    SetPlayerSkin(playerid, 280);
                    format(string, sizeof(string), "* %s gets on a medical uniform.", PlayerNameEx(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid uniform!");
                    return 1;
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Uniform [Uniform ID]");
            SendClientMessage(playerid, COLOR_YELLOW, "_________Uniform List_________");
            SendClientMessage(playerid, COLOR_WHITE, "0: No Uniform");
            SendClientMessage(playerid, COLOR_WHITE, "1: Medic Uniform 1");
            SendClientMessage(playerid, COLOR_WHITE, "2: Medic Uniform 2");
            SendClientMessage(playerid, COLOR_WHITE, "3: Medic Uniform 3");
            return 1;
        }
    }
    return 1;
}



Re: Have I misplaced a bracket or something? - Snipa - 13.08.2012

pawn Код:
if(PlayerInfo[playerid][pMember] == 3)
Shouldn't it be
pawn Код:
if(PlayerInfo[playerid][pMember] != 3)



Re: Have I misplaced a bracket or something? - Luke_James - 13.08.2012

I use != for jobs and == for factions, == works for everything else


Re: Have I misplaced a bracket or something? - Weaselpwns - 13.08.2012

Can we have a compile output?


Re: Have I misplaced a bracket or something? - SEnergy - 13.08.2012

what PlayerInfo[playerid][pMember] is Medic Job?

edit: from the code I see that pMember 3 is Medic job, can you tell me why the hell do you have at the top of your command this?

Код:
if(PlayerInfo[playerid][pMember] == 3)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a part of SD-EMS!!");
        return 1;
    }
so if player IS medic it will tell him that he is not medic? change it to

pawn Код:
if(PlayerInfo[playerid][pMember] != 3)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a part of SD-EMS!!");
        return 1;
    }
as the guy in first (?) reply said


Re: Have I misplaced a bracket or something? - Luke_James - 13.08.2012

I said that != is used for jobs, and == is used for factions (SD-EMS is a faction), but previously the medic stuff was for a job, but I changed it to a faction. So, would != 3 work?

EDIT: It compiles fine


Re: Have I misplaced a bracket or something? - SEnergy - 13.08.2012

dude, what the hell are you talking about?

== means that 2 variables are equal, != means that they are NOT equal, you should totally go and learn some basic scripting/programming before you start to make scripts