Why this error? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why this error? (
/showthread.php?tid=64754)
Why this error? -
harrold - 07.02.2009
My code:
pawn Код:
// Top
new something[MAX_PLAYERS][2]
// in a callback
new variable[128];
variable = something[playerid][1];
Error:
Код:
error 033: array must be indexed (variable "variable")
How to fix?
Re: Why this error? -
luby - 07.02.2009
Код:
// Top
new something[MAX_PLAYERS][2]
// in a callback
new variable[128];
variable[1] = something[playerid][1];
try this?
or
Код:
// Top
new something[MAX_PLAYERS][2][128]
// in a callback
new variable[128];
variable = something[playerid][1];
Re: Why this error? -
harrold - 07.02.2009
Don't work
Re: Why this error? -
Nero_3D - 07.02.2009
its better if you explain what you want to do
Re: Why this error? -
Mikep - 07.02.2009
If its a string, use format.
What are you using the variable for?
Re: Why this error? -
harrold - 07.02.2009
Quote:
Originally Posted by Mikeshake
If its a string, use format.
What are you using the variable for?
|
For a dissconnect reason
if anybody ban a player then the reason will be changed in something
Re: Why this error? -
harrold - 07.02.2009
But something strange:
if i do:
pawn Код:
something[playerid][1] = "Some Reason here";
Then it give this error:
Код:
error 006: must be assigned to an array
Re: Why this error? -
Mikep - 07.02.2009
Variable = "String";
Re: Why this error? -
luby - 07.02.2009
Quote:
Originally Posted by harrold
But something strange:
if i do:
pawn Код:
something[playerid][1] = "Some Reason here";
Then it give this error:
Код:
error 006: must be assigned to an array
|
try
pawn Код:
something[playerid][1][128] = "Some Reason here";
Re: Why this error? -
harrold - 07.02.2009
if i go use strings then it won't work
pawn Код:
something[playerid][strlen(string)]=string;
Код:
error 006: must be assigned to an array
Re: Why this error? -
luby - 07.02.2009
Quote:
Originally Posted by harrold
if i go use strings then it won't work
pawn Код:
something[playerid][strlen(string)]=string;
Код:
error 006: must be assigned to an array
|
You just should to define string as
Код:
new something[MAX_PLAYERS][2][128];
assign it like
Код:
something[playerid][1] = "BUhahaha lol imao";
and use like
Код:
print(something[playerid][1]);
Re: Why this error? -
harrold - 07.02.2009
Thanks man that works