Raised This Month: $120 Target: $400
 30% 

Solved Argument type mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nG_getwreck
Senior Member
Join Date: Oct 2020
Location: Philippines from South K
Old 05-24-2021 , 22:42   Argument type mismatch
Reply With Quote #1

Hello, I recently wrote my version of CSO zombie classes and I came up with this error in compiling.

PHP Code:
banshee.sma(307) : error 035argument type mismatch (argument 1)

Line 307write_short("sprites/ef_bat.spr"
__________________

Last edited by nG_getwreck; 05-25-2021 at 01:27.
nG_getwreck is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-24-2021 , 22:50   Re: Argument type mismatch
Reply With Quote #2

Think about what the error says... "argument type mismatch"

Looking at the function definition (by the way, 'short' indicates a number)

Code:
native write_short(x);

Usage
x	Number to write
So the compiler is expecting a number as an argument and you are giving it a string, hence "argument type mismatch"

You would use write_string() to send a string
__________________

Last edited by Bugsy; 05-24-2021 at 22:51.
Bugsy is offline
nG_getwreck
Senior Member
Join Date: Oct 2020
Location: Philippines from South K
Old 05-25-2021 , 01:27   Re: Argument type mismatch
Reply With Quote #3

Problem solved:
PHP Code:
new g_bat_spr

public plugin_precache()
{
     
g_bat_spr engfunc(EngFunc_PrecacheModel"sprites/ef_bat.spr")
}

public ??? {
   
write_short(g_bat_spr// return a value from precaching

__________________
nG_getwreck is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:38.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode