Raised This Month: $12 Target: $400
 3% 

float problem with write_coord()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dark_Siders
Member
Join Date: Aug 2013
Location: Dreaming World
Old 07-27-2014 , 04:06   float problem with write_coord()
Reply With Quote #1

I have a problem with using float variables in write_coord().

When i use float variables in write_coord() i get tag mismatch error on compiling.

What is the problem? please help!
__________________
***********
I want to die peacefully in my sleep like my grandfather, not screaming in terror like his passengers.

***********
Dark_Siders is offline
bat
Veteran Member
Join Date: Jul 2012
Old 07-27-2014 , 04:20   Re: float problem with write_coord()
Reply With Quote #2

Post code
__________________
bat is offline
Send a message via Skype™ to bat
Dark_Siders
Member
Join Date: Aug 2013
Location: Dreaming World
Old 07-27-2014 , 04:26   Re: float problem with write_coord()
Reply With Quote #3

Quote:
Originally Posted by bat View Post
Post code
PHP Code:
#include <amxmodx>

#define TE_GUNSHOT 2

new PLUGIN[] = "Gun Shot Effect"
new AUTHOR[] = "LeriCo"
new VERSION[] = "1.0"

new Float:fOrigin[3]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /gunshot""GunShotFunc"0)
}

public 
GunShotFunc(id)
{
    
fOrigin[0] = 312.061096
    fOrigin
[1] = -335.421661
    fOrigin
[2] = -594.627014
    
    message_begin
(MSG_ALLSVC_TEMPENTITY)
    
write_byte(TE_GUNSHOT)
    
write_coord(fOrigin[0])
    
write_coord(fOrigin[1])
    
write_coord(fOrigin[2])
    
message_end()

This is a simple code for testing gunshot effect.
__________________
***********
I want to die peacefully in my sleep like my grandfather, not screaming in terror like his passengers.

***********

Last edited by Dark_Siders; 07-27-2014 at 04:27.
Dark_Siders is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-27-2014 , 04:48   Re: float problem with write_coord()
Reply With Quote #4

write_coord() is for integers. Use EngFunc_WriteCoord.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-27-2014 , 04:54   Re: float problem with write_coord()
Reply With Quote #5

Or use floatround to convert them to integers....
HamletEagle is offline
bat
Veteran Member
Join Date: Jul 2012
Old 07-27-2014 , 04:56   Re: float problem with write_coord()
Reply With Quote #6

Yeah Mr.Hornet correсtly written.

Code:
#include <amxmodx>
#include <fakemeta>

#define TE_GUNSHOT 2

new PLUGIN[] = "Gun Shot Effect"
new AUTHOR[] = "LeriCo"
new VERSION[] = "1.0"

new Float:fOrigin[3]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /gunshot", "GunShotFunc", 0)
}

public GunShotFunc(id)
{
    fOrigin[0] = 312.061096
    fOrigin[1] = -335.421661
    fOrigin[2] = -594.627014
    
    engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, fOrigin, 0)
    write_byte(TE_GUNSHOT)
    engfunc(EngFunc_WriteCoord, fOrigin[0])
    engfunc(EngFunc_WriteCoord, fOrigin[1])
    engfunc(EngFunc_WriteCoord, fOrigin[2])
    message_end()
}
__________________
bat is offline
Send a message via Skype™ to bat
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-27-2014 , 05:47   Re: float problem with write_coord()
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Or use floatround to convert them to integers....
Not a good way because your calling extra natives to achieve an incorrect result.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Reply



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 16:23.


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