AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problems compiling (https://forums.alliedmods.net/showthread.php?t=25371)

wonsae 03-12-2006 17:58

Problems compiling
 
Code:
public makecar(id) {    new item[32], orig1[6], orig2[6], orig3[6], angles1[6], Float:origin[3], steamid    read_argv(1, item, 31)    read_argv(2, orig1, 5)    read_argv(3, orig2, 5)    read_argv(4, orig3, 5)    read_argv(5, angles1, 5)    read_argv(6, steamid, 32)    origin[0] = float(str_to_num(orig1))    origin[1] = float(str_to_num(orig2))    origin[2] = float(str_to_num(orig3))    new Float:angles2 = float(str_to_num(angles1))    steamid = get_user_authid(id,authid,32)    new car = create_entity("info_target")    if(!car) {       client_print(id,print_chat,"CAR WAS not created. Error.^n")       return PLUGIN_HANDLED    }

That part makes these 2 errors

Code:

Error: Argument type mismatch (argument 2) on line 61
Error: Undefined symbol "authid" on line 68

and this

Code:
public setcar(entid,id) {    if(allow[id] != 0) return PLUGIN_HANDLED    if(incar[id] != 0) return PLUGIN_HANDLED    if(equal(steamid,authid) && incar[id] == 0) {}    else return PLUGIN_HANDLED

make this error

Code:

Error: Undefined symbol "steamid" on line 228

Jordan 03-12-2006 18:37

Top one:

steamid isn't an arg - in that case it should be steamid[33] (because your highest number in that sense is 32).

authid is never defined - it should also be an arg - authid[33] (because you use get_user_authid(id, authid, 32).

Also, for the third one, you defined what steamid was in one function, but it's separate from the other function, so the other function doesn't know what steamid is - you either have to redefine it, or globally define it.

wonsae 03-13-2006 14:31

Code:
public makecar(id) {    new item[32], orig1[6], orig2[6], orig3[6], angles1[6], Float:origin[3], steamid[33]    read_argv(1, item, 31)    read_argv(2, orig1, 5)    read_argv(3, orig2, 5)    read_argv(4, orig3, 5)    read_argv(5, angles1, 5)    read_argv(6, steamid[33], 32)    origin[0] = float(str_to_num(orig1))    origin[1] = float(str_to_num(orig2))    origin[2] = float(str_to_num(orig3))    new Float:angles2 = float(str_to_num(angles1))    steamid[33] = get_user_authid(id,steamid[33],32)

Now I get these errors
Code:

Error: Array index out of bounds (variable "steamid") on line 61
Error: Array index out of bounds (variable "steamid") on line 68


Werewolf 03-13-2006 15:07

Don't add [33] after steamid in
Code:
read_argv(6, steamid[33], 32)
and
Code:
steamid[33] = get_user_authid(id,steamid[33],32)
I think that will solve your problem :roll:
+ Defining a steamid with itself looks a bit wierd :lol:

wonsae 03-13-2006 15:31

Code:
   steamid[33] = get_user_authid(id,authid[33],32)
meh i still get these errors
btw i changed it to authid[33] because of your comment ><

Code:

Error: Array index out of bounds (variable "steamid") on line 67
Warning: Expression has no effect on line 67
Error: Expected token: ";", but found "]" on line 67
Error: Invalid expression, assumed zero on line 67
Error: Too many error messages on one line on line 67


Zenith77 03-13-2006 15:42

Quote:

Originally Posted by wonsae
Code:
   steamid[33] = get_user_authid(id,authid[33],32)
meh i still get these errors
btw i changed it to authid[33] because of your comment ><

Code:

Error: Array index out of bounds (variable "steamid") on line 67
Warning: Expression has no effect on line 67
Error: Expected token: ";", but found "]" on line 67
Error: Invalid expression, assumed zero on line 67
Error: Too many error messages on one line on line 67


dont include the [33] or else the complier is going to access element 33 of the array where it is supposed to terminate giving you the out of bounds error

Code:
   steamid = get_user_authid(id,authid,32)

Werewolf 03-13-2006 16:18

Quote:

Originally Posted by Zenith77
dont include the [33]

That's exactly what I said :P
Quote:

Originally Posted by Werewolf
Don't add [33]

Hihi :D

Zenith77 03-13-2006 16:31

Sorry I sometimes just scan over posts when I'm in a hurry :)

wonsae 03-13-2006 17:04

so it would be this?
Code:
public makecar(id) {    new item[32], orig1[6], orig2[6], orig3[6], angles1[6], Float:origin[3], steamid[33]    read_argv(1, item, 31)    read_argv(2, orig1, 5)    read_argv(3, orig2, 5)    read_argv(4, orig3, 5)    read_argv(5, angles1, 5)    read_argv(6, steamid, 32)    origin[0] = float(str_to_num(orig1))    origin[1] = float(str_to_num(orig2))    origin[2] = float(str_to_num(orig3))    new Float:angles2 = float(str_to_num(angles1))    steamid = get_user_authid(id,authid,32)

or this
Code:
public makecar(id) {    new item[32], orig1[6], orig2[6], orig3[6], angles1[6], Float:origin[3], steamid[33]    read_argv(1, item, 31)    read_argv(2, orig1, 5)    read_argv(3, orig2, 5)    read_argv(4, orig3, 5)    read_argv(5, angles1, 5)    read_argv(6, steamid, 32)    origin[0] = float(str_to_num(orig1))    origin[1] = float(str_to_num(orig2))    origin[2] = float(str_to_num(orig3))    new Float:angles2 = float(str_to_num(angles1))    steamid[33] = get_user_authid(id,authid,32)
[/small]

wonsae 03-13-2006 17:30

OK I got it down to 3 errors

Code:
public makecar(id) {     new item[32], orig1[6], orig2[6], orig3[6], angles1[6], Float:origin[3], steamid[33]     read_argv(1, item, 31)     read_argv(2, orig1, 5)     read_argv(3, orig2, 5)     read_argv(4, orig3, 5)     read_argv(5, angles1, 5)     read_argv(6, steamid, 32)             origin[0] = float(str_to_num(orig1))     origin[1] = float(str_to_num(orig2))     origin[2] = float(str_to_num(orig3))     new Float:angles2 = float(str_to_num(angles1))     new steamid[33] = get_user_authid(id,steamid,32)

errors are


Code:

Error: Symbol already defined: "steamid" on line 67
Error: Must be a constant expression; assumed zero on line 67
Warning: Symbol is assigned a value that is never used: "steamid" on line 103


[/code]


All times are GMT -4. The time now is 20:27.

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