Raised This Month: $ Target: $400
 0% 

Solved Help with strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-12-2017 , 12:19   Help with strings
Reply With Quote #1

how do i bypass this compiler error in this situation ?

"arguments does not match the definition"

PHP Code:
entity_set_model(iWeaponBox"models/weapon/w_%s.mdl"sWeaponModel
__________________

Last edited by Depresie; 07-14-2017 at 11:20.
Depresie is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-12-2017 , 12:28   Re: Help with strings
Reply With Quote #2

Read the documentation for entity_set_model.
klippy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-12-2017 , 12:43   Re: Help with strings
Reply With Quote #3

I tried with formatex to format the string before sending it to the native, compiler error is gone

But i still have a problem, why the fuck does this keeps crashing on me
I tested using client print and the string is fine, but for some reason it is crashing the server..
I tried inserting the string directly and it works.. any ideas ?

PHP Code:
    formatex(sWeaponModelcharsmax(sWeaponModel), "models/v_%s.mdl"sWeaponName)
    
set_pev(iOwnerpev_viewmodel2sWeaponModel)

    
formatex(sWeaponModelcharsmax(sWeaponModel), "models/p_%s.mdl"sWeaponName)
    
set_pev(iOwnerpev_weaponmodelsWeaponModel
__________________

Last edited by Depresie; 07-12-2017 at 13:47.
Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-12-2017 , 14:00   Re: Help with strings
Reply With Quote #4

pev_weaponmodel2. pev_weaponmodel expects an offset from EngFunc_AllocString.
__________________
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-12-2017 , 23:40   Re: Help with strings
Reply With Quote #5

What?

Code:
entity_set_model(iWeaponBox, "models/weapon/w_%s.mdl", sWeaponModel)

Quote:
/* Sets the model of an Entity. */
native entity_set_model(iIndex, const szModel[]);
Then what do you can do is:

Code:
formatex(szModel, charsmax(szmodel), "models/weapon/w_%s", W_MODEL)...

Use entity_set_string(owner, EV_SZ_[view|weapon]model) instead of pev.
__________________









Last edited by CrazY.; 07-12-2017 at 23:43.
CrazY. 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 22:45.


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