Required ranks problem
#1

I can't get this on work:

Код:
 case 1:
			{ if( rank[playerid] < 1 ){
				ShowPlayerDialog(playerid, DIALOG_SNIPER, DIALOG_STYLE_MSGBOX, "Class Information", "Information...", "Choose", "Back");
                                else SendClientMessage(playerid,1) "You have not rank 1" ))
			}
Suggestions?
Reply
#2

try explaining what is wrong with it.
Reply
#3

try
pawn Код:
{ if( rank[playerid] > 0 ){
or
pawn Код:
{ if( rank[playerid] >= 1 ){
Reply
#4

pawn Код:
if( rank[playerid] == 1 )
{
           ShowPlayerDialog(playerid, DIALOG_SNIPER, DIALOG_STYLE_MSGBOX, "Class Information","Information...", "Choose", "Back");
}
else SendClientMessage(playerid,1) "You are not rank 1" ))
Reply
#5

Try this, if it doesn't work show us your enum.

pawn Код:
{
if(rank[playerid] < 1) return SendClientMessage(playerid, -1, "You are not a rank 1."
ShowPlayerDialog(playerid, DIALOG_SNIPER, DIALOG_STYLE_MSGBOX, "Class Information", "Information...", "Choose", "Back");
}
I do this with admin stuff on my server, so it should work.
Reply
#6

Код:
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(156) : warning 225: unreachable code
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(164) : error 017: undefined symbol "rank"
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(164) : warning 215: expression has no effect
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(164) : error 001: expected token: ";", but found "]"
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(164) : error 029: invalid expression, assumed zero
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(164) : fatal error 107: too many error messages on one line
(ignore the warnings)

This are the ranks:
Код:
CheckForLevelUpdate(playerid);
stock CheckForLevelUpdate(playerid)
{
    if ( GetPlayerScore(playerid) >= 5 ) {
        if( rank[playerid] < 1 ) {
            PlayerPlaySound(playerid, 1150, 0, 0, 0);
            SendClientMessage(playerid, COLOR_CON_GREEN,"You Got Promoted!");
            SendClientMessage(playerid, COLOR_CON_GREEN, "*You are a Private!");
            rank[playerid] = 1;
            SetPlayerWantedLevel(playerid, rank[playerid]);
            GivePlayerMoney(playerid, 10000);
        }
    }

    if ( GetPlayerScore(playerid) >= 50 ) {
        if( rank[playerid] < 2 ) {
            PlayerPlaySound(playerid, 1150, 0, 0, 0);
            SendClientMessage(playerid, COLOR_CON_GREEN,"You Got Promoted!");
            SendClientMessage(playerid, COLOR_CON_GREEN, "**You are a Corporal!");
            rank[playerid] = 2;
            SetPlayerWantedLevel(playerid, rank[playerid]);
            GivePlayerMoney(playerid, 20000);
        }
    }
Reply
#7

Use a clear indentation style so you can actually see what code happens as the result of an if():

pawn Код:
if(something)
{
    var++;
    if(var == 5)
    {
        // Do something
    }
}
else
{
    var = 0
}
is MUCH easier to understand than:

pawn Код:
if(something) {
    var++;
    if(var == 5) {
        // Do something
    }
}
else {
var = 0;
}
Reply
#8

pawn Код:
// At The Top
#include < a_samp >
// Defines
#define something ..
// Global Variables
new
    rank[ MAX_PLAYERS ];
// At The bottom   
stock CheckForLevelUpdate( playerid )
{
    if( GetPlayerScore( playerid ) >= 5 )
    {
        if( rank[ playerid ] < 1 )
        {
            PlayerPlaySound( playerid, 1150, 0, 0, 0 );
            SendClientMessage( playerid, COLOR_CON_GREEN, "You Got Promoted!" );
            SendClientMessage( playerid, COLOR_CON_GREEN, "*You are a Private!" );
            rank[ playerid ] = 1;
            SetPlayerWantedLevel( playerid, rank[ playerid ] );
            GivePlayerMoney( playerid, 10000 );
        }
    }
    if( GetPlayerScore( playerid ) >= 50 )
    {
        if( rank[ playerid ] < 2 )
        {
            PlayerPlaySound( playerid, 1150, 0, 0, 0 );
            SendClientMessage( playerid, COLOR_CON_GREEN, "You Got Promoted!" );
            SendClientMessage( playerid, COLOR_CON_GREEN, "**You are a Corporal!" );
            rank[ playerid ] = 2;
            SetPlayerWantedLevel( playerid, rank[ playerid ] );
            GivePlayerMoney( playerid, 20000 );
        }
    }
    return 1;
}
Reply
#9

Thanks Dwane. It's solved
Reply
#10

Weird, by editting the SendClientMessages :
Код:
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(308) : error 030: compound statement not closed at the end of file (started at line 159)
All statements are closed and there is no line 308?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)