Need help with this command, please.
#1

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

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

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)