SA-MP Forums Archive
I need help Plz - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help Plz (/showthread.php?tid=387744)



I need help Plz - dr.lozer - 26.10.2012

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



Re: I need help Plz - [TC]XxJuggaloxX - 26.10.2012

Quote:

new BombCode[10] = {

Change to 11


Re: I need help Plz - jessejanssen - 26.10.2012

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


Re: I need help Plz - dr.lozer - 26.10.2012

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|   };



Re: I need help Plz - jessejanssen - 26.10.2012

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


Re: I need help Plz - dr.lozer - 26.10.2012

OMG!!! Im the biggest dumb!! Sorry BTW Thanks!!! Rep+


Re: I need help Plz - dr.lozer - 26.10.2012

-.- 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"},
};



Re: I need help Plz - B-Matt - 26.10.2012

In both way you won't get errors.