AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Array Not Indexed (https://forums.alliedmods.net/showthread.php?t=281523)

gabuch2 04-13-2016 13:51

Array Not Indexed
 
PHP Code:

new szName[32], origin[3]
get_user_name(idszNamecharsmax(szName))
get_user_origin(idorigin0)

[...]

DispatchKeyValue(monster[id], "origin"origin[0]+" "+origin[1]+" "+origin[2])
[...]
DispatchKeyValue(monster[id], "displayname"szName+"'s Bodyguard"

Code:

(43) error 033: array must be indexed (variable "-unknown-")
(47) error 033: array must be indexed (variable "szName")

43 and 47 are the both DispatchKeyValue lines.

Am I missing something here?

klippy 04-13-2016 14:05

Re: Array Not Indexed
 
You can't just add(concatenate) strings like that, Pawn isn't JavaScript or such. Use formatex() to format your strings.

gabuch2 04-13-2016 14:12

Re: Array Not Indexed
 
Didn't know that! (Also I'm used to C# :P)

Thank you, it compiles correctly now!


All times are GMT -4. The time now is 18:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.