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

Solved Function prototypes do not match


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 09-08-2020 , 20:59   Function prototypes do not match
Reply With Quote #1

Hello there!

I get these errors. Can someone help me?
HTML Code:
// F:\ASX\carantina\Update 1808\.vRAC_AntiRush.sp(2407) : error 100: function prototypes do not match
// F:\ASX\carantina\Update 1808\.vRAC_AntiRush.sp(2429) : error 100: function prototypes do not match
PHP Code:
stock SpawnTriggerMultipleInBox(iZoneIndex)
{
    new 
Float:fMiddle[3], Float:fMins[3], Float:fMaxs[3];
    
    
decl String:sZoneName[128];
    new 
Handle:hZone GetArrayCell(g_hZonesiZoneIndex);
    
GetArrayString(hZone0sZoneNamesizeof(sZoneName));
    
GetArrayArray(hZone1fMins3);
    
GetArrayArray(hZone2fMaxs3);
    
    new 
iEnt CreateEntityByName("trigger_multiple");
    
    
DispatchKeyValue(iEnt"spawnflags""64");
    
Format(sZoneNamesizeof(sZoneName), "sm_zone %s"sZoneName);
    
DispatchKeyValue(iEnt"targetname"sZoneName);
    
DispatchKeyValue(iEnt"wait""0");
    
    
DispatchSpawn(iEnt);
    
ActivateEntity(iEnt);
    
SetEntProp(iEntProp_Data"m_spawnflags"64 );
    
    
GetMiddleOfABox(fMinsfMaxsfMiddle);
    
    
TeleportEntity(iEntfMiddleNULL_VECTORNULL_VECTOR);
    
SetEntityModel(iEnt"models/items/car_battery01.mdl");
    
    
// Have the mins always be negative
    
fMins[0] = fMins[0] - fMiddle[0];
    if(
fMins[0] > 0.0)
        
fMins[0] *= -1.0;
    
fMins[1] = fMins[1] - fMiddle[1];
    if(
fMins[1] > 0.0)
        
fMins[1] *= -1.0;
    
fMins[2] = fMins[2] - fMiddle[2];
    if(
fMins[2] > 0.0)
        
fMins[2] *= -1.0;
    
    
// And the maxs always be positive
    
fMaxs[0] = fMaxs[0] - fMiddle[0];
    if(
fMaxs[0] < 0.0)
        
fMaxs[0] *= -1.0;
    
fMaxs[1] = fMaxs[1] - fMiddle[1];
    if(
fMaxs[1] < 0.0)
        
fMaxs[1] *= -1.0;
    
fMaxs[2] = fMaxs[2] - fMiddle[2];
    if(
fMaxs[2] < 0.0)
        
fMaxs[2] *= -1.0;
    
    
SetEntPropVector(iEntProp_Send"m_vecMins"fMins);
    
SetEntPropVector(iEntProp_Send"m_vecMaxs"fMaxs);
    
SetEntProp(iEntProp_Send"m_nSolidType"2);
    
    new 
iEffects GetEntProp(iEntProp_Send"m_fEffects");
    
iEffects |= 32;
    
SetEntProp(iEntProp_Send"m_fEffects"iEffects);
    
    
HookSingleEntityOutput(iEnt"OnStartTouch"EntOut_OnStartTouch); //ERROR 1 HERE
}

stock KillTriggerEntity(iZoneIndex)
{
    new 
Handle:hZone;
    
decl String:sZoneName[128];
    
hZone GetArrayCell(g_hZonesiZoneIndex);
    
GetArrayString(hZone0sZoneNamesizeof(sZoneName));
    
Format(sZoneNamesizeof(sZoneName), "sm_zone %s"sZoneName);
    
    new 
iEnts GetMaxEntities();
    
decl String:sClassName[256];
    for(new 
i=MaxClients;i<iEnts;i++)
    {
        if(
IsValidEntity(i)
        && 
IsValidEdict(i)
        && 
GetEdictClassname(isClassNamesizeof(sClassName))
        && 
StrContains(sClassName"trigger_multiple") != -1
        
&& GetEntPropString(iProp_Data"m_iName"sClassNamesizeof(sClassName))
        && 
StrEqual(sClassNamesZoneNamefalse))
        {
            
UnhookSingleEntityOutput(i"OnStartTouch"EntOut_OnStartTouch); //ERROR 2 HERE
            
AcceptEntityInput(i"Kill");
            break;
        }
    }

__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098

Last edited by OXYD; 09-10-2020 at 12:44.
OXYD is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 09-08-2020 , 22:20   Re: Function prototypes do not match
Reply With Quote #2

Quote:
Originally Posted by OXYD View Post
Hello there!

I get these errors. Can someone help me?
HTML Code:
// F:\ASX\carantina\Update 1808\.vRAC_AntiRush.sp(2407) : error 100: function prototypes do not match
// F:\ASX\carantina\Update 1808\.vRAC_AntiRush.sp(2429) : error 100: function prototypes do not match
The error means that your function's callback doesn't match what the compiler expects it to be.

Code:
HookSingleEntityOutput(iEnt, "OnStartTouch", EntOut_OnStartTouch); //ERROR 1 HERE
HookSingleEntityOutput takes a callback with the EntityOutput function prototype, so your EntOut_OnStartTouch function (which you haven't posted) needs to have the same parameters and return type as one of those.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 09-09-2020 , 06:13   Re: Function prototypes do not match
Reply With Quote #3

My Bad

PHP Code:
public EntOut_OnStartTouch(const String:output[], calleractivatorFloat:delayHandle:event)
{
    
    if(
g_bIsRushAllowed || !GetConVarBool(g_hCVEnable))
    {
        return;
    }
    
    
//Check if it's warmup period
    
if(GameRules_GetProp("m_bWarmupPeriod") == && !GetConVarBool(g_hCVWarmupEnable))
    {
        
//LogMessage("Punishing disabled during warmup");
        
return;
    }
    
    
/*// if the touching entity is a weapon, remove it, if we strip to knife
    decl String:sClassName[64];
    if(iPunishment == 4
    && IsValidEntity(activator)
    && IsValidEdict(activator)
    && GetEdictClassname(activator, sClassName, sizeof(sClassName))
    && StrContains(sClassName, "weapon_") != -1
    && GetEntPropEnt(activator, Prop_Send, "m_hOwnerEntity") == -1)
    {
        RemoveEdict(activator);
    }*/
    
    // Ignore dead players
    
if(activator || activator MaxClients || !IsPlayerAlive(activator))
        return;
    
    
// Admin immune?
    
if(GetConVarBool(g_hCVAdminImmunity) && CheckCommandAccess(activator"antirush_immune"ADMFLAG_GENERICtrue))
    {
        return;
    }
    
    
decl String:sTargetName[256];
    
GetEntPropString(callerProp_Data"m_iName"sTargetNamesizeof(sTargetName));
    
ReplaceString(sTargetNamesizeof(sTargetName), "sm_zone """);
    
    
// Check if he's in the team, this zone blocks
    
new iSize GetArraySize(g_hZones), iZonePunishment = -1;
    new 
Handle:hZone;
    
decl String:sZoneName[64];
    for(new 
i=0;i<iSize;i++)
    {
        
hZone GetArrayCell(g_hZonesi);
        
GetArrayString(hZone0sZoneNamesizeof(sZoneName));
        
// Check the team for this zone
        
if(StrEqual(sZoneNamesTargetName))
        {
            new 
iTeam GetArrayCell(hZone3);
            
iZonePunishment GetArrayCell(hZone4);
            if(
iTeam != && GetClientTeam(activator) != iTeam)
                return;
        }
    }
    
    new 
iPunishment GetConVarInt(g_hCVPunishment);
    if(
iZonePunishment 0)
        
iPunishment iZonePunishment;
    
    switch(
iPunishment)
    {
        
// Just tell everybody
        
case 1:
        {
            
decl String:sName[64];
            
GetClientName(activatorsNamesizeof(sName));
            
PrintToChatAll("%s%t"PREFIX"Player Entered Zone"sNamesTargetName);
        }
        
// Bounce him back
        
case 2:
        {
            new 
Float:fVelocity[3];
            
fVelocity[0] = GetEntPropFloat(activatorProp_Send"m_vecVelocity[0]"); 
            
fVelocity[1] = GetEntPropFloat(activatorProp_Send"m_vecVelocity[1]"); 
            
fVelocity[2] = GetEntPropFloat(activatorProp_Send"m_vecVelocity[2]");
            
            
fVelocity[0] *= -2.0;
            
fVelocity[1] *= -2.0;
            
// Always bounce back with at least 200 velocity
            
if(fVelocity[1] > 0.0 && fVelocity[1] < 200.0)
                
fVelocity[1] = 200.0;
            else if(
fVelocity[1] < 0.0 && fVelocity[1] > -200.0)
                
fVelocity[1] = -200.0;
            
// Never push the player up.
            
if(fVelocity[2] > 0.0)
                
fVelocity[2] *= -1.0;

            
TeleportEntity(activatorNULL_VECTORNULL_VECTORfVelocity);
        }
        
// Slay
        
case 3:
        {
            
ForcePlayerSuicide(activator);
            
decl String:sName[64];
            
GetClientName(activatorsNamesizeof(sName));
            
PrintToChatAll("%s%t"PREFIX"Player Slayed"sNamesTargetName);
        }
        
// Only allow the usage of the knife
        
case 4:
        {
            
// Let the player hold the knife
            
new iWeapon GetPlayerWeaponSlot(activator2);
            
decl String:sWeapon[32];
            if(
iWeapon != -1)
            {
                
GetEdictClassname(iWeaponsWeaponsizeof(sWeapon));
                
FakeClientCommand(activator"use %s"sWeapon);
            }
            
            
// Don' allow the usage of other weapons but the knife
            
g_bPlayerIsRushing[activator] = true;
        }
        
// Allow the usage of any weapon again
        
case 5:
        {
            
g_bPlayerIsRushing[activator] = false;
        }
        
    }

__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098
OXYD is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 09-10-2020 , 02:32   Re: Function prototypes do not match
Reply With Quote #4

Quote:
Originally Posted by OXYD View Post
My Bad :)

Code:
public EntOut_OnStartTouch(const String:output[], caller, activator, Float:delay, Handle:event)
In this case, you need to specify either Action or void as the return type (lack of return type is implicit int in legacy syntax), and the prototype doesn't have Handle event as one of its parameters. Check the second link in my previous post for reference.

const String:output[] is also legacy syntax. The modern way to declare that would be const char[] output, but it looks like the compiler doesn't complain about the legacy form, so while I'd encourage you to migrate to the modern syntax, there's no problem keeping that as-is.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 09-10-2020 at 04:08.
nosoop is offline
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 09-10-2020 , 12:43   Re: Function prototypes do not match
Reply With Quote #5

Quote:
Originally Posted by nosoop View Post
In this case, you need to specify either Action or void as the return type (lack of return type is implicit int in legacy syntax), and the prototype doesn't have Handle event as one of its parameters. Check the second link in my previous post for reference.

const Stringutput[] is also legacy syntax. The modern way to declare that would be const char[] output, but it looks like the compiler doesn't complain about the legacy form, so while I'd encourage you to migrate to the modern syntax, there's no problem keeping that as-is.
Thanks, i finally managed to make it work after i updated the old syntax to the new one. Apparently, more or less, the problem was coming from that Handle:event.
__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098
OXYD 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 08:43.


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