I need help Plz
#1

hi SA-MP GAmers i need help! please fix this code it gives me Error

Код:
new BombCode[10] = {
	"qw4hddc",
	"122sf5j",
	"wow62uok",
	"nbg2388",
	"2825871",
	"256ad2n",
	"ho863dn",
	"ali0sob",
	"ano6543",
	"ngt7788"
};

public OnPlayerEnterCheckpoint(playerid)
{
	new string[128];
	if(GetPlayerTeam(playerid) == Terrorist) {
		new c = random(sizeof(BombCode));
		format(string,128,"Type this code '%s' To Plaze Bomb",BombCode[c]);
		SendClientMessage(playerid, COLOR_GREEN,string);
	}
	return 1;
}
ERROR
Код:
error 018: initialization data exceeds declared size
Reply
#2

Quote:

new BombCode[10] = {

Change to 11
Reply
#3

Quote:
Originally Posted by dr.lozer
Посмотреть сообщение
hi SA-MP GAmers i need help! please fix this code it gives me Error

Код:
new BombCode[10] = {
	"qw4hddc",
	"122sf5j",
	"wow62uok",
	"nbg2388",
	"2825871",
	"256ad2n",
	"ho863dn",
	"ali0sob",
	"ano6543",
	"ngt7788"
};

public OnPlayerEnterCheckpoint(playerid)
{
	new string[128];
	if(GetPlayerTeam(playerid) == Terrorist) {
		new c = random(sizeof(BombCode));
		format(string,128,"Type this code '%s' To Plaze Bomb",BombCode[c]);
		SendClientMessage(playerid, COLOR_GREEN,string);
	}
	return 1;
}
ERROR
Код:
error 018: initialization data exceeds declared size
Quote:
Originally Posted by [TC]XxJuggaloxX
Посмотреть сообщение
Change to 11
Changing "BombCode[10]" to "BombCode[11]" won't work, as he just uses 10 "places" ( 0 up to 9 ). But as it's a string it needs a stringlength too, change "BombCode[10]" to "BombCode[10][32]" and you're good.

Jesse
Reply
#4

It dont work!!! Again it gives me error
Код:
D:\SA-MPS~1\GAMEMO~1\Gamemode.pwn(722) : error 029: invalid expression, assumed zero
D:\SA-MPS~1\GAMEMO~1\Gamemode.pwn(722) : error 008: must be a constant expression; assumed zero
the line is

Код:
711|   new BombCode[10][32] = {
712|	   "qw4hddc",
713|	   "122sf5j",
714|	   "wow62uok",
715|	   "nbg2388",
716|	   "2825871",
717|	   "256ad2n",
718|	   "ho863dn",
719|	   "ali0sob",
720|	   "ano6543",
721|	   "ngt7788",
722|   };
Reply
#5

Quote:
Originally Posted by dr.lozer
Посмотреть сообщение
It dont work!!! Again it gives me error
Код:
D:\SA-MPS~1\GAMEMO~1\Gamemode.pwn(722) : error 029: invalid expression, assumed zero
D:\SA-MPS~1\GAMEMO~1\Gamemode.pwn(722) : error 008: must be a constant expression; assumed zero
the line is

Код:
711|   new BombCode[10][32] = {
712|	   "qw4hddc",
713|	   "122sf5j",
714|	   "wow62uok",
715|	   "nbg2388",
716|	   "2825871",
717|	   "256ad2n",
718|	   "ho863dn",
719|	   "ali0sob",
720|	   "ano6543",
721|	   "ngt7788",
722|   };
Indeed, I didn't notice it the first time I looked at the code but you should do it like this:
pawn Код:
new BombCode[10][32] = {
{"qw4hddc"},
{"122sf5j"},
{"wow62uok"},
{"nbg2388"},
{"2825871"},
{"256ad2n"},
{"ho863dn"},
{"ali0sob"},
{"ano6543"},
{"ngt7788"},
};
Jesse
Reply
#6

OMG!!! Im the biggest dumb!! Sorry BTW Thanks!!! Rep+
Reply
#7

-.- Dude
Код:
new BombCode[10][32] = {
{"qw4hddc"},
{"122sf5j"},
{"wow62uo"},
{"nbg2388"},
{"2825871"},
{"256ad2n"},
{"ho863dn"},
{"ali0sob"},
{"ano6543"},
{"ngt7788"}
};
not like this
Код:
new BombCode[10][32] = {
{"qw4hddc"},
{"122sf5j"},
{"wow62uo"},
{"nbg2388"},
{"2825871"},
{"256ad2n"},
{"ho863dn"},
{"ali0sob"},
{"ano6543"},
{"ngt7788"},
};
Reply
#8

In both way you won't get errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)