AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Pls some help (https://forums.alliedmods.net/showthread.php?t=8835)

szblb 12-28-2004 07:48

Pls some help
 
This Code:
Code:
pos_tav[0]=pos_tav[0]/1.5 pos_tav[1]=pos_tav[1]/1.5 pos_tav[2]=pos_tav[2]/1.5

I have some problems :
- tag mismatch
- tag mismatch
- tag mismatch

Pls help

THX

Johnny got his gun 12-28-2004 09:18

Make sure to declare it float.

Code:
new Float:pos_tav[3]

XxAvalanchexX 12-28-2004 12:37

Yes, since you divide by a float and get a float as the result, but your data type cannot hold a float, it returns a tag mismatch. You could declare the variables as floats, as JGHG said, or if you want the data to be integers you can use the floatround function. Additionally, maybe you should try this shortcut operator:

Code:
pos_tav[0] /= 1.5 pos_tav[1] /= 1.5 pos_tav[2] /= 1.5

szblb 12-29-2004 05:48

Code:
public cmd_com(id) {     new pos_from[3]     new pos_to[3]     new Float:pos_tav[3]     new pos_set[3]         //------------------------------------------     //------------------------------------------     get_user_origin(id,pos_from,0)     get_user_origin(id,pos_to,3)     //------------------------------------------     pos_tav[0]=pos_to[0]-pos_from[0]     pos_tav[1]=pos_to[1]-pos_from[1]     pos_tav[2]=pos_to[2]-pos_from[2]     //------------------------------------------     pos_tav[0] = pos_tav[0]/1.5     pos_tav[1] = pos_tav[0]/1.5     pos_tav[2] = pos_tav[0]/1.5     //------------------------------------------     pos_set[0]=pos_to[0]-pos_tav[0]     pos_set[1]=pos_to[1]-pos_tav[1]     pos_set[2]=pos_to[2]-pos_tav[2]     //------------------------------------------     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)     write_byte(11)     write_coord(pos_from[0]+random_num(-50,50))     write_coord(pos_from[1]+random_num(-50,50))     write_coord(pos_from[2]+random_num(-50,50))     message_end()     //------------------------------------------     set_user_origin(id,pos_set)     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)     write_byte(11)     write_coord(pos_set[0])     write_coord(pos_set[1])     write_coord(pos_set[2]+10)     message_end() }

"new Float:pos_tav[3]" ---> Too many tag mismatch

pos_tav[0] /= 1.5 Not good :(

:?

LynX 12-29-2004 07:19

Tag mismatch, does your plugin even compiles?
Because I sometimes get many tag mismatches, and it compiles and works.


All times are GMT -4. The time now is 19:26.

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