AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Help with strings (https://forums.alliedmods.net/showthread.php?t=299368)

Depresie 07-12-2017 12:19

Help with strings
 
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


klippy 07-12-2017 12:28

Re: Help with strings
 
Read the documentation for entity_set_model.

Depresie 07-12-2017 12:43

Re: Help with strings
 
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


HamletEagle 07-12-2017 14:00

Re: Help with strings
 
pev_weaponmodel2. pev_weaponmodel expects an offset from EngFunc_AllocString.

CrazY. 07-12-2017 23:40

Re: Help with strings
 
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.


All times are GMT -4. The time now is 22:45.

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