AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved amxxpc crashes when using tagof (https://forums.alliedmods.net/showthread.php?t=299186)

SpawnerF 07-06-2017 10:09

amxxpc crashes when using tagof
 
Code:
stock ArrayList.Clear( Arrayname )                  ArrayDestroy( Arrayname ); stock ArrayList.Get( Arrayname, key, var[] )        ArrayGetString( Arrayname, key, var, charsmax( var ) ) stock ArrayList.Count( Arrayname )                  ArraySize( Arrayname ); stock ArrayList.Add( Arrayname, string )            ArrayPushString( Arrayname, string ); stock ArrayList.Remove( Arrayname, {Int,String}:key[], tagType = tagof(key), exactMatch = true, maxBuff = 224 ){         if( tagType == tagof(Int:) ) ArrayDeleteItem( dynamicMenu, str_to_num(key) ) // = crash     else if( tagType == tagof(String:){ // = crash                 new var[maxBuff];         for( new i; i < ArrayList.Count( dynamicMenu ); i++ ){             ArrayList.Get( Arrayname, i, var )             if( exactMatch ?                 equal( var, key ) : ( containi(var, key ) != - 1  ) ){                 // Do something             }                     }     }   }

DjSoftero 07-06-2017 13:47

Re: amxxpc crashes when using tagof
 
i didn`t really get your problem. explain more
and this part of code isn`t enough to help.

Craxor 07-06-2017 15:02

Re: amxxpc crashes when using tagof
 
amxxpc crashes? what?

SpawnerF 07-06-2017 15:38

Re: amxxpc crashes when using tagof
 
The compiler crash when using if( tagType == tagof(Int:) )

klippy 07-06-2017 15:45

Re: amxxpc crashes when using tagof
 
Don't try to imitate C#, Java or whatever language it is. That dot notation doesn't work in Pawn, your code has many more problems than just tagof. And integers aren't tagget with Int and strings aren't tagged with String.

SpawnerF 07-06-2017 15:50

Re: amxxpc crashes when using tagof
 
Quote:

Originally Posted by KliPPy (Post 2533793)
Don't try to imitate C#, Java or whatever language it is. That dot notation doesn't work in Pawn, your code has many more problems than just tagof. And integers aren't tagget with Int and strings aren't tagged with String.

I'm not trying to do that, I just like it that way.

I'm using this

Code:
#define ArrayList. __ArrayList__

String: and Int: Is just to make the difference, I didn't found a way to override a function so I used this way ...

klippy 07-06-2017 16:02

Re: amxxpc crashes when using tagof
 
Unless you tag a symbol yourself, that symbol's tag is _:. There's no difference between integer arrays and strings and you can't override that way. Just use separate functions named accordingly, don't override. Pawn is like C in many aspects (it was called Small C at first).

PRoSToTeM@ 07-06-2017 19:38

Re: amxxpc crashes when using tagof
 
Use amxx 1.8.3 compiler.
Or use hack like this:
Code:
static Int:int; #pragma unused int ... if (tagType == tagof(int))

Hehe, this is interesting idea! We can make safe set_pev now.

SpawnerF 07-07-2017 09:15

Re: amxxpc crashes when using tagof
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2533832)
...

Thank's a lot!


All times are GMT -4. The time now is 23:09.

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