SA-MP Forums Archive
Need help with this command, 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: Need help with this command, please. (/showthread.php?tid=322409)



Need help with this command, please. - rangerxxll - 02.03.2012

Hello. I'm trying to make this command, so if you're Team_CT then you can't access the locker. And if you're TEAM_TE you can. Here's my current code.

pawn Код:
CMD:locker(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0, 2238.39990234,-1050.09997559,54.20000076))
    {
        if(gTeam[playerid] == TEAM_TE)
        {
            ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Locker", "M4A1\nSilenced Pistol\nMP5", "Take", "Exit");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not near your teams locker!");
        }
        else if(gTeam[playerid] == TEAM_CT)
        {
            SendClientMessage(playerid, COLOR_RED, "This locker is for Terrorists only!");
        }
    }
    return 1;
}
Can I get some feedback on whats wrong with it? Thanks.
Oh, and here's my errors.
Код:
C:\Users\Luke\Desktop\Scripting\gamemodes\urban.pwn(494) : error 029: invalid expression, assumed zero
C:\Users\Luke\Desktop\Scripting\gamemodes\urban.pwn(494) : warning 215: expression has no effect
C:\Users\Luke\Desktop\Scripting\gamemodes\urban.pwn(494) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Line 494 is this one.
pawn Код:
else if(gTeam[playerid] == TEAM_CT)



AW: Need help with this command, please. - Drebin - 02.03.2012

pawn Код:
CMD:locker(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0, 2238.39990234,-1050.09997559,54.20000076))
    {
        if(gTeam[playerid] == TEAM_TE)
        {
            ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Locker", "M4A1\nSilenced Pistol\nMP5", "Take", "Exit");
        }
        else if(gTeam[playerid] == TEAM_CT)
        {
            SendClientMessage(playerid, COLOR_RED, "This locker is for Terrorists only!");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not near your teams locker!");
        }
    }
    return 1;
}



Re: Need help with this command, please. - TRIPLE-xXx-GAMEING - 02.03.2012

CMD:locker(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 2238.39990234,-1050.09997559,54.20000076))
{
if(gTeam[playerid] == TEAM_TE)
{
ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Locker", "M4A1\nSilenced Pistol\nMP5", "Take", "Exit");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're not near your teams locker!");
}
else if(gTeam[playerid] == TEAM_CT)
{
SendClientMessage(playerid, COLOR_RED, "This locker is for Terrorists only!");
}
}
return 1;
}

it says that your line else if dosent work coz i dont know too lol i am not scipting from days then too
try it in this way
//--------------------------------------------------------------------------------------------------------
CMD:locker(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 2238.39990234,-1050.09997559,54.20000076))
{
if(gTeam[playerid] == TEAM_CT)
{
SendClientMessage(playerid, COLOR_RED, "This locker is for Terrorists only!");
}
}
return 1;
}
CMD:locker(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 2238.39990234,-1050.09997559,54.20000076))
{
if(gTeam[playerid] == TEAM_TE)
{
ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "Locker", "M4A1\nSilenced Pistol\nMP5", "Take", "Exit");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're not near your teams locker!");
}
}
return 1;
}
//its in my style lol


Re: Need help with this command, please. - niels44 - 02.03.2012

if you have more then 2 classes you an also use:
pawn Код:
if(gTeam[playerid] != TEAM_TE)
the ! means that if its not the TE team.