Required ranks problem -
MSI - 22.01.2012
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?
Re: Required ranks problem -
Snowman12 - 22.01.2012
try explaining what is wrong with it.
Re: Required ranks problem -
Babul - 22.01.2012
try
pawn Код:
{ if( rank[playerid] > 0 ){
or
pawn Код:
{ if( rank[playerid] >= 1 ){
Re: Required ranks problem -
jamesbond007 - 22.01.2012
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" ))
Re: Required ranks problem -
JhnzRep - 22.01.2012
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.
Re: Required ranks problem -
MSI - 22.01.2012
Код:
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);
}
}
Re: Required ranks problem -
MP2 - 22.01.2012
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;
}
Re: Required ranks problem -
Konstantinos - 22.01.2012
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;
}
Re: Required ranks problem -
MSI - 22.01.2012
Thanks Dwane. It's solved
Re: Required ranks problem -
MSI - 22.01.2012
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?