AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Number of arguments does not match definition. (https://forums.alliedmods.net/showthread.php?t=86923)

xbatista 03-04-2009 11:45

Number of arguments does not match definition.
 
I've tryied to convert random spawn to fakemeta.
The probelm is here:
PHP Code:

fm_find_sphere_class(id"player"200.0iEnts1

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define MAP_MAX         3800.0

#define fm_find_ent_in_sphere(%1,%2,%3) engfunc(EngFunc_FindEntityInSphere, %1, %2, %3)

#define PLUGIN "biohazard: Buy_spawn"
#define VERSION "1.0"
#define AUTHOR "ds811888"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /spawn""cmd_buyspawn")
}
public 
cmd_buyspawn(id)
{
        
// spawn
        
random_spawn(id)
}

public 
random_spawn(id)
{
    static 
Float:vOrigin[3],iContents
    
    vOrigin
[0] = random_float(-MAP_MAX,MAP_MAX)
    
vOrigin[1] = random_float(-MAP_MAX,MAP_MAX)    
    
vOrigin[2] = -MAP_MAX
    
    
do
    {
        if(
vOrigin[2] > MAP_MAX)
            return 
random_spawn(id)
            
        
vOrigin[2] += 10.0
        iContents 
EF_PointContents(vOrigin)
    }
    while(
iContents != CONTENTS_EMPTY)
    
    
vOrigin[2] += 200.0
    
if(EF_PointContents(vOrigin) != CONTENTS_EMPTY)
        return 
random_spawn(id)
    
vOrigin[2] -= 160.0
    
    
for(new iCount 0;iCount 2;iCount++)
    {
        for(new 
Float:flDist = -36.0;flDist 36.0;flDist += 36.0)
        {
            
vOrigin[2] += flDist
            
            vOrigin
[iCount] += 33.0
            
if(EF_PointContents(vOrigin) != CONTENTS_EMPTY)
                return 
random_spawn(id)
            
vOrigin[iCount] -= 33.0
            
            vOrigin
[iCount] -= 33.0
            
if(EF_PointContents(vOrigin) != CONTENTS_EMPTY)
                return 
random_spawn(id)
            
vOrigin[iCount] += 33.0        
            
            vOrigin
[2] -= flDist
        
}
    }
    
    new 
iEnt
    
while((iEnt fm_find_ent_in_sphere(iEnt,vOrigin,20.0)) != 0)
        if(
pev(iEntpev_solid) != SOLID_NOT && pev(idpev_solid) != SOLID_TRIGGER)
            return 
random_spawn(id)
    
    
set_pev(idpev_origin,vOrigin)
    
    if(
pev(idpev_flags) & FL_INWATER)
        return 
PLUGIN_CONTINUE
        
    
new iEnts[1]
    
fm_find_sphere_class(id"player"200.0iEnts1)
    
    if(
iEnts[0])
        return 
random_spawn(id)
        
    
set_task(0.1,"fnCheckLocation",id)
    
    return 
PLUGIN_CONTINUE
}
public 
random_spawn_location(id)
{
    new 
iFlags
    pev
(idpev_flagsiFlags)
    if(
iFlags FL_INWATER || iFlags FL_SWIM || iFlags FL_FLOAT)
        
random_spawn(id)
}
stock fm_find_sphere_class(aroundent, const _lookforclassname[], Float:radiusentlist[], maxents, const Float:_origin[3])
{
    static 
Float:origin[3]
    if(!
pev_valid(aroundent))
    {
        
origin[0] = _origin[0]
        
origin[1] = _origin[1]
        
origin[2] = _origin[2]
    }
    else
        
pev(aroundentpev_originorigin)
 
    new 
ent 0foundents 0
    
while((ent engfunc(EngFunc_FindEntityInSpherearoundentoriginradius)) != 0)
    {
        if(!
pev_valid(ent))
            continue;
 
        if(
foundents >= maxents)
            break;
 
        static 
classname[32]
        
pev(entpev_classnameclassname31)
 
        if(
equal(classname_lookforclassname))
        
entlist[foundents++] = ent
    
}
    return 
foundents;

stock EF_PointContents(const Float:VECTOR[3])
{
    return 
engfunc(EngFunc_PointContentsVECTOR);



Exolent[jNr] 03-04-2009 12:13

Re: Number of arguments does not match definition.
 
Woops, didn't pay attention to function names.

xbatista 03-04-2009 12:15

Re: Number of arguments does not match definition.
 
There are stock... :)


PHP Code:

fm_find_sphere_class(id"player"200.0iEnts1

PHP Code:

stock fm_find_sphere_class(aroundent, const _lookforclassname[], Float:radiusentlist[], maxents, const Float:_origin[3]) 

    static 
Float:origin[3
    if(!
pev_valid(aroundent)) 
    { 
        
origin[0] = _origin[0
        
origin[1] = _origin[1
        
origin[2] = _origin[2
    } 
    else 
        
pev(aroundentpev_originorigin
  
    new 
ent 0foundents 
    
while((ent engfunc(EngFunc_FindEntityInSpherearoundentoriginradius)) != 0
    { 
        if(!
pev_valid(ent)) 
            continue; 
  
        if(
foundents >= maxents
            break; 
  
        static 
classname[32
        
pev(entpev_classnameclassname31
  
        if(
equal(classname_lookforclassname)) 
        
entlist[foundents++] = ent 
    

    return 
foundents



Exolent[jNr] 03-04-2009 12:19

Re: Number of arguments does not match definition.
 
Sorry. You are still missing the last origin argument in the function.
This error is really easy to see if you just look at the code...

xbatista 03-04-2009 12:21

Re: Number of arguments does not match definition.
 
http://www.amxmodx.org/funcwiki.php?...lass&go=search
BUt when was included engine stock it compiles fine :/
wtf?

Exolent[jNr] 03-04-2009 12:25

Re: Number of arguments does not match definition.
 
I'm done with you. You obviously don't know what you are doing because you don't understand the basic concepts of pawn scripting.

xbatista 03-04-2009 12:26

Re: Number of arguments does not match definition.
 
I just need convert it to fakemeta ^^
So?
PHP Code:

fm_find_sphere_class(id"player"200.0iEnts1vOrigin



All times are GMT -4. The time now is 17:06.

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