Error!
#1

PHP код:
new deathmatch_HumanClasses[30][3] = {
if(
pGeneral[playerid][PLR_NEWBIE] == 1){
{
CIVILIAN,0,5},
}
else
{
CIVILIAN,0,5},
}
{
POLICEMAN,3000,280},
{
MEDIC,7000,275},
{
SCOUT,11000,230},
{
HEAVYMEDIC,17000,274},
{
FARMER,25000,161},
{
ENGINEER,32000,27},
{
SWAT,45000,285},
{
HEAVYSHOTGUN,50000,25},
{
ADVANCEDMEDIC,63000,276},
{
ADVANCEDENGINEER,72000,260},
{
FEDERALAGENT,90000,163},
{
KICKBACK,110000,149},
{
ADVANCEDSCOUT,150000,29},
{
SOLDIER,300000,287},
{
DOCTOR,750000,70},
{
HERSHEL,900000,62},
{
ADVANCEDSOLDIER,2000000,287},
{
SUPPORTER,PREMIUM_CLASS_SUPPORTER,35},
{
SPONSOR,PREMIUM_CLASS_SPONSOR,123},
{
ELITE,PREMIUM_CLASS_ELITE,294},
{
MYCLASS,0,0},
{
VETERAN,0,179},
{
SAMURAI,650000,203},
{
RESEARCH,850000,73},
{
INVENTOR,150000,8},
{
SHERIFF,200000,283},
{
KEPPLER,2500000,295},
{
ADVHERSHEL,2700000,68},
{
BULLET,2300000,121}
}; 
PHP код:
if(pGeneral[playerid][PLR_NEWBIE] == 1){
{
CIVILIAN,0,5},
}
else
{
CIVILIAN,0,5},

HERE IS ERROR I NEED TO FIX.

Can someone help me how to fix this? it shows me erro
Reply
#2

I think you don't need a "," for only one line.

And what kind of error, you're getting?

Quote:

if(pGeneral[playerid][PLR_NEWBIE] == 1){
{CIVILIAN,0,5}
}
else
{CIVILIAN,0,5}
}

Reply
#3

C:\Users\Arlindi\Desktop\X-Portal - V2.6.8 - FINAL\samp server\pawno\include\x_include/x_deathmatch/x_deathmatch.inc(103) : error 029: invalid expression, assumed zero
C:\Users\Arlindi\Desktop\X-Portal - V2.6.8 - FINAL\samp server\pawno\include\x_include/x_deathmatch/x_deathmatch.inc(106) : error 010: invalid function or declaration
C:\Users\Arlindi\Desktop\X-Portal - V2.6.8 - FINAL\samp server\pawno\include\x_include/x_deathmatch/x_deathmatch.inc(13 : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#4

Show the entire code. I don't think you can put conditional statements inside arrays like that, but I'm not quite sure.
Reply
#5

You can't put conditional statements in Arrays. It should be done like this:

PHP код:
if(pGeneral[playerid][PLR_NEWBIE] == 1) {
     new 
deathmatch_HumanClasses[][] = {
     {
CIVILIAN,0,5}
     };
} else {
     new 
deathmatch_HumanClasses[][] = {
     {
CIVILIAN,0,5},
     {
POLICEMAN,3000,280},
     {
MEDIC,7000,275},
     {
SCOUT,11000,230},
     {
HEAVYMEDIC,17000,274},
     {
FARMER,25000,161},
     {
ENGINEER,32000,27},
     {
SWAT,45000,285},
     {
HEAVYSHOTGUN,50000,25},
     {
ADVANCEDMEDIC,63000,276},
     {
ADVANCEDENGINEER,72000,260},
     {
FEDERALAGENT,90000,163},
     {
KICKBACK,110000,149},
     {
ADVANCEDSCOUT,150000,29},
     {
SOLDIER,300000,287},
     {
DOCTOR,750000,70},
     {
HERSHEL,900000,62},
     {
ADVANCEDSOLDIER,2000000,287},
     {
SUPPORTER,PREMIUM_CLASS_SUPPORTER,35},
     {
SPONSOR,PREMIUM_CLASS_SPONSOR,123},
     {
ELITE,PREMIUM_CLASS_ELITE,294},
     {
MYCLASS,0,0},
     {
VETERAN,0,179},
     {
SAMURAI,650000,203},
     {
RESEARCH,850000,73},
     {
INVENTOR,150000,8},
     {
SHERIFF,200000,283},
     {
KEPPLER,2500000,295},
     {
ADVHERSHEL,2700000,68},
     {
BULLET,2300000,121}
     };

Reply
#6

That also won't work because that creates local variables that are only visible in their respective scopes. There is no way to conditionally initialize arrays.
Reply
#7

Can someone else tell me how can i do that ? PLS
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)