Raised This Month: $ Target: $400
 0% 

Type casting in functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-22-2009 , 10:48   Re: Type casting in functions
Reply With Quote #1

Float:myVar[3]={0.0, 0.0, 0.0}
__________________
Arkshine is offline
orglee
Member
Join Date: Dec 2005
Old 08-22-2009 , 11:17   Re: Type casting in functions
Reply With Quote #2

Oh darn I forgot to put it in my example.

PHP Code:
(stock/public) myFunction(Float:myVar[3]={0.00.00.0})
{
  
// Function body
}

public 
cp_teleport(iPlayerFloat:fPosition[3], Float:fAngles[3]={0.00.00.0})
{
    
set_pev(iPlayerpev_velocityFloat:{0.00.00.0});
    
set_pev(iPlayerpev_originfPosition);
    
    if(
fAngles[0] != 0.0 && fAngles[1] != 0.0 && fAngles[2] != 0.0)
    {
        
entity_set_vector(iPlayerEV_VEC_anglesfAngles);
        
entity_set_int(iPlayerEV_INT_fixangle1);
        
DuckDelay(iPlayer);
    }

Problem still remains.

Cause when function is public parser shows me fallowing error.

Quote:
Error: Function argument may not have a default value (variable "fAngles") on line 496
orglee 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 15:06.


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