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

[ANY] Gifts!


Post New Thread Reply   
 
Thread Tools Display Modes
Mr.Freeman
Senior Member
Join Date: Nov 2013
Location: Canada
Old 12-26-2013 , 23:47   Re: [ANY] Gifts!
Reply With Quote #21

Am I the only one getting a error 035 : argument type mismatch when I try to recompile the test.sp?
Mr.Freeman is offline
Nolongerinthegame
AlliedModders Donor
Join Date: Sep 2005
Old 11-03-2014 , 14:30   Re: [ANY] Gifts!
Reply With Quote #22

Any more news on getting this working on CSGO?
Nolongerinthegame is offline
Afonia
Member
Join Date: Jun 2014
Old 12-04-2014 , 02:19   Re: [ANY] Gifts!
Reply With Quote #23

Help hats do not work:
L 12/04/2014 - 09:15:19: [store.smx] LookupAttachment signature is out of date or not supported in this game. Hats will be disabled. Please contact the author.
L 12/04/2014 - 09:15:19: [store.smx] Gifts! isn't installed or failed to load. Gifts support will be disabled. Please install Gifts. (http://forums.alliedmods.net/showthread.php?t=175185)
Game CS:GO
Afonia is offline
Send a message via Skype™ to Afonia
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 02-09-2015 , 03:09   Re: [ANY] Gifts!
Reply With Quote #24

i can't get the test zgifts.sp to compile
error 035: getting argument type mismatch <argument 1>
8guawong is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 02-09-2015 , 23:11   Re: [ANY] Gifts!
Reply With Quote #25

ok for people who are having problems compiling the test plugin you have to change

PHP Code:
Gifts_RegisterPlugin("Gifts_ClientPickUp"); 
to

PHP Code:
Gifts_RegisterPlugin(Gifts_ClientPickUp); 
another question is i try to change it so it doesn't spawn gift on death but on infected (for zombie reloaded)
but the gifts are not spawning ..... can some1 or Zeph help?

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <gifts>
#include <zephstocks>
#include <zombiereloaded>

#define PLUGIN_VERSION "2.3"

enum Module
{
    
Handle:hPlugin,
    Function:
fnCallback
}

enum SpawnedGift
{
    
Handle:hPlugin,
    Function:
fnCallback,
    
Float:fPosition[3],
    
String:szModel[PLATFORM_MAX_PATH],
    
bool:bStay,
    
iData,
    
iOwner
}

new 
g_cvarChance = -1;
new 
g_cvarLifetime = -1;
new 
g_cvarModel = -1;

new 
bool:g_bEnabled false;

new 
Handle:g_hPlugins INVALID_HANDLE;
new 
Handle:g_hSpawned INVALID_HANDLE;

new 
GiftConditions:g_eConditions[MAXPLAYERS+1];

new 
g_eSpawnedGiftsTemp[2048][SpawnedGift];
new 
g_eSpawnedGifts[2048][SpawnedGift];

public 
Plugin:myinfo =
{
    
name "[ANY] Gifts",
    
author "Zephyrus",
    
description "Gifts :333",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
IdentifyGame();
    
    
HookEvent("round_start"Event_RoundStart);
    
    
g_cvarChance RegisterConVar("sm_gifts_chance""0.60""Chance that a gift will be spawned upon player death."TYPE_FLOATINVALID_FUNCTION0true0.0true1.0);
    
g_cvarLifetime RegisterConVar("sm_gifts_lifetime""10.0""Lifetime of the gift."TYPE_FLOAT);

    new 
String:m_szGameDir[64];
    
GetGameFolderName(STRING(m_szGameDir));
    
    if(
strcmp(m_szGameDir"cstrike")==0)
        
g_cvarModel RegisterConVar("sm_gifts_model""models/items/cs_gift.mdl""Model file for the gift"TYPE_STRING);
    else if(
strcmp(m_szGameDir"dod")==0)
        
g_cvarModel RegisterConVar("sm_gifts_model""models/items/dod_gift.mdl""Model file for the gift"TYPE_STRING);
    else if(
strcmp(m_szGameDir"tf")==0)
        
g_cvarModel RegisterConVar("sm_gifts_model""models/items/tf_gift.mdl""Model file for the gift"TYPE_STRING);
    else
        
g_cvarModel RegisterConVar("sm_gifts_model""<you should set some gift model>""Model file for the gift"TYPE_STRING);

    
AutoExecConfig();

    
g_hSpawned CreateGlobalForward("Gifts_OnGiftSpawned"ET_EventParam_Cell);
}

public 
OnMapStart()
{
    
g_bEnabled false;
    if(
FileExists(g_eCvars[g_cvarModel][sCache]) || FileExists(g_eCvars[g_cvarModel][sCache], true))
    {
        
g_bEnabled true;
        
PrecacheModel(g_eCvars[g_cvarModel][sCache]);
        
Downloader_AddFileToDownloadsTable(g_eCvars[g_cvarModel][sCache]);
    }

    for(new 
i=0;i<2048;++i)
        
g_eSpawnedGifts[i][hPlugin]=INVALID_HANDLE;
}

public 
OnClientDisconnect(client)
{
    
g_eConditions[client]=Condition_None;
}

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
g_hPlugins CreateArray(2);

    
CreateNative("Gifts_RegisterPlugin"Native_RegisterPlugin);
    
CreateNative("Gifts_RemovePlugin"Native_RemovePlugin);
    
CreateNative("Gifts_SetClientCondition"Native_SetClientCondition);
    
CreateNative("Gifts_GetClientCondition"Native_GetClientCondition);
    
CreateNative("Gifts_SpawnGift"Native_SpawnGift);

    return 
APLRes_Success;
}

public 
Native_RegisterPlugin(Handle:pluginnumParams)
{
    new 
m_szModule[Module];

    
m_szModule[hPlugin]=plugin;
    
m_szModule[fnCallback]=GetNativeCell(1);

    if(
m_szModule[fnCallback]==INVALID_FUNCTION)
        return 
0;

    
PushArrayArray(g_hPluginsm_szModule[0]);
    
    return 
1;
}

public 
Native_RemovePlugin(Handle:pluginnumParams)
{
    new 
m_szModule[Module];
    for(new 
i=0;i<GetArraySize(g_hPlugins);++i)
    {
        
GetArrayArray(g_hPluginsim_szModule[0]);
        if(
m_szModule[hPlugin]==plugin)
        {
            
RemoveFromArray(g_hPluginsi);
            return 
1;
        }
    }
    return 
0;
}

public 
Native_SetClientCondition(Handle:pluginnumParams)
{
    
g_eConditions[GetNativeCell(1)]=GiftConditions:GetNativeCell(2);
    return 
0;
}

public 
Native_GetClientCondition(Handle:pluginnumParams)
{
    return 
_:g_eConditions[GetNativeCell(1)];
}

public 
Native_SpawnGift(Handle:pluginnumParams)
{
    new 
Float:m_fLifetime GetNativeCell(3);
    if(
m_fLifetime == -2.0)
        
m_fLifetime g_eCvars[g_cvarLifetime][aCache];
    new 
Float:m_fPosition[3];
    new 
String:m_szModel[PLATFORM_MAX_PATH];
    
GetNativeArray(4m_fPosition3);
    
GetNativeString(2STRING(m_szModel));

    if(
m_szModel[0] == 0)
        
strcopy(STRING(m_szModel), g_eCvars[g_cvarModel][sCache]);

    new 
m_iIndex Stock_SpawnGift(m_fPositionm_szModelm_fLifetime);
    if(
m_iIndex != -1)
    {
        
g_eSpawnedGifts[m_iIndex][hPlugin] = plugin;
        
g_eSpawnedGifts[m_iIndex][fnCallback] = GetNativeCell(1);
        
g_eSpawnedGifts[m_iIndex][iData] = GetNativeCell(5);
        
g_eSpawnedGifts[m_iIndex][iOwner] = GetNativeCell(6);
        
g_eSpawnedGifts[m_iIndex][fPosition] = m_fPosition;
        
g_eSpawnedGifts[m_iIndex][bStay] = (m_fLifetime == -1.0?true:false);
        
strcopy(g_eSpawnedGifts[m_iIndex][szModel], PLATFORM_MAX_PATHm_szModel);
    }
    return 
m_iIndex;
}

public 
ZR_OnClientInfected(clientattackerbool:motherInfectbool:respawnOverridebool:respawn)
{
    
    if(!
g_bEnabled)
        return 
Plugin_Continue;

    if(
Float:g_eCvars[g_cvarChance][aCache]>0.0)
    {
        new 
random GetRandomInt(1RoundToNearest(100/(Float:g_eCvars[g_cvarChance][aCache]*100)));
        if(
random==1)
        {
            
decl Float:pos[3];
            
GetClientAbsOrigin(clientpos);

            if(
g_bTF)
                
pos[2]+=15.0;
            else
                
pos[2]-=50.0;
            
Stock_SpawnGift(posg_eCvars[g_cvarModel][sCache], Float:g_eCvars[g_cvarLifetime][aCache]);
        }
    }
}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
i=0;i<2048;++i)
        if(
g_eSpawnedGifts[i][hPlugin])
        {
            
// ugh......
            
decl Float:m_fPosition[3];
            
m_fPosition[0] = g_eSpawnedGifts[i][fPosition][0];
            
m_fPosition[1] = g_eSpawnedGifts[i][fPosition][1];
            
m_fPosition[2] = g_eSpawnedGifts[i][fPosition][2];
            new 
m_iIndex Stock_SpawnGift(m_fPositiong_eSpawnedGifts[i][szModel], 0.0);

            if(
m_iIndex != -1)
            {
                
g_eSpawnedGiftsTemp[m_iIndex][hPlugin] = g_eSpawnedGifts[i][hPlugin];
                
g_eSpawnedGiftsTemp[m_iIndex][fnCallback] = g_eSpawnedGifts[i][fnCallback];
                
g_eSpawnedGiftsTemp[m_iIndex][iData] = g_eSpawnedGifts[i][iData];
                
g_eSpawnedGiftsTemp[m_iIndex][iOwner] = g_eSpawnedGifts[i][iOwner];
                
g_eSpawnedGiftsTemp[m_iIndex][fPosition] = g_eSpawnedGifts[i][fPosition]
                
g_eSpawnedGiftsTemp[m_iIndex][bStay] = g_eSpawnedGifts[i][bStay];
                
strcopy(g_eSpawnedGiftsTemp[m_iIndex][szModel], PLATFORM_MAX_PATHg_eSpawnedGifts[i][szModel]);
            }
        }
    for(new 
i=0;i<2048;++i)
    {
        if(
g_eSpawnedGiftsTemp[i][hPlugin])
        {
            
g_eSpawnedGifts[i][hPlugin] = g_eSpawnedGiftsTemp[i][hPlugin];
            
g_eSpawnedGifts[i][fnCallback] = g_eSpawnedGiftsTemp[i][fnCallback];
            
g_eSpawnedGifts[i][iData] = g_eSpawnedGiftsTemp[i][iData];
            
g_eSpawnedGifts[i][iOwner] = g_eSpawnedGiftsTemp[i][iOwner];
            
g_eSpawnedGifts[i][fPosition] = g_eSpawnedGiftsTemp[i][fPosition]
            
g_eSpawnedGifts[i][bStay] = g_eSpawnedGiftsTemp[i][bStay];
            
strcopy(g_eSpawnedGifts[i][szModel], PLATFORM_MAX_PATHg_eSpawnedGiftsTemp[i][szModel]);
        }
        else
        {
            
g_eSpawnedGifts[i][hPlugin] = INVALID_HANDLE;
            
g_eSpawnedGifts[i][fnCallback] = INVALID_FUNCTION;
        }
    }

    return 
Plugin_Continue;
}

stock Stock_SpawnGift(Float:position[3], const String:model[], Float:lifetime)
{
    
decl m_iGift;

    if((
m_iGift CreateEntityByName("prop_physics_override")) != -1)
    {
        new 
String:targetname[100], String:m_szModule[256];

        
Format(STRING(targetname), "gift_%i"m_iGift);

        
DispatchKeyValue(m_iGift"model"model);
        
DispatchKeyValue(m_iGift"physicsmode""2");
        
DispatchKeyValue(m_iGift"massScale""1.0");
        
DispatchKeyValue(m_iGift"targetname"targetname);
        
DispatchSpawn(m_iGift);
        
        
SetEntProp(m_iGiftProp_Send"m_usSolidFlags"8);
        
SetEntProp(m_iGiftProp_Send"m_CollisionGroup"1);
        
        if(
lifetime 0.0)
        {
            
Format(m_szModulesizeof(m_szModule), "OnUser1 !self:kill::%0.2f:-1"lifetime);
            
SetVariantString(m_szModule);
            
AcceptEntityInput(m_iGift"AddOutput");
            
AcceptEntityInput(m_iGift"FireUser1");
        }
    
        
TeleportEntity(m_iGiftpositionNULL_VECTORNULL_VECTOR);
        
        if(!
g_bTF)
        {
            new 
m_iRotator CreateEntityByName("func_rotating");
            
DispatchKeyValueVector(m_iRotator"origin"position);
            
DispatchKeyValue(m_iRotator"targetname"targetname);
            
DispatchKeyValue(m_iRotator"maxspeed""200");
            
DispatchKeyValue(m_iRotator"friction""0");
            
DispatchKeyValue(m_iRotator"dmg""0");
            
DispatchKeyValue(m_iRotator"solid""0");
            
DispatchKeyValue(m_iRotator"spawnflags""64");
            
DispatchSpawn(m_iRotator);
            
            
SetVariantString("!activator");
            
AcceptEntityInput(m_iGift"SetParent"m_iRotatorm_iRotator);
            
AcceptEntityInput(m_iRotator"Start");

            if(
lifetime 0.0)
            {
                
SetVariantString(m_szModule);
                
AcceptEntityInput(m_iRotator"AddOutput");
                
AcceptEntityInput(m_iRotator"FireUser1");
            }
            
            
SetEntPropEnt(m_iGiftProp_Send"m_hEffectEntity"m_iRotator);
        }

        
SDKHook(m_iGiftSDKHook_StartTouchOnStartTouch);
    }

    
Call_StartForward(g_hSpawned);
    
Call_PushCell(m_iGift);
    
Call_Finish();

    return 
m_iGift;
}

public 
OnStartTouch(m_iGiftclient)
{
    if(!(
0<client<=MaxClients))
        return;

    if(
g_eConditions[client]==Condition_InCondition)
        return;

    if(
g_eSpawnedGifts[m_iGift][hPlugin] != INVALID_HANDLE)
        if(
g_eSpawnedGifts[m_iGift][iOwner] == client)
            return;

    new 
m_iRotator GetEntPropEnt(m_iGiftProp_Send"m_hEffectEntity");
    if(
m_iRotator && IsValidEdict(m_iRotator))
        
AcceptEntityInput(m_iRotator"Kill");
    
CreateTimer(0.0RemoveEntitym_iGift);

    if(
g_eSpawnedGifts[m_iGift][hPlugin] != INVALID_HANDLE)
    {
        
Call_StartFunction(g_eSpawnedGifts[m_iGift][hPlugin], g_eSpawnedGifts[m_iGift][fnCallback]);
        
Call_PushCell(client);
        
Call_PushCell(g_eSpawnedGifts[m_iGift][iData]);
        
Call_PushCell(g_eSpawnedGifts[m_iGift][iOwner]);
        
Call_Finish();
        
g_eSpawnedGifts[m_iGift][hPlugin] = INVALID_HANDLE;
    }
    else if(
GetArraySize(g_hPlugins)!=0)
    {
        new 
id GetRandomInt(0GetArraySize(g_hPlugins)-1);
        
        new 
m_szModule[Module];
        
GetArrayArray(g_hPluginsidm_szModule[0]);
        
        
Call_StartFunction(m_szModule[hPlugin], m_szModule[fnCallback]);
        
Call_PushCell(client);
        
Call_PushCell(m_iGift);
        
Call_Finish();
    }
}

public 
Action:RemoveEntity(Handle:timerany:m_iGift)
{
    if(
IsValidEntity(m_iGift))
        
AcceptEntityInput(m_iGift"Kill");
    return 
Plugin_Stop;

--------------------------edit------------------------
the reason above code don't spawn is b/c the gift is spawned into the dirt so just change pos[2]-=50.0; to pos[2]+=80.0 (right above player's head)

Last edited by 8guawong; 02-10-2015 at 02:59.
8guawong is offline
itiap
BANNED
Join Date: Nov 2015
Old 11-23-2015 , 07:53   Re: [ANY] Gifts!
Reply With Quote #26

I have this error. And i cant fix it. Can you help me ?
Code:
L 11/23/2015 - 07:17:03: [SM] Native "Call_StartFunction" reported: Invalid function id (140)
L 11/23/2015 - 07:17:03: [SM] Displaying call stack trace for plugin "gifts.smx":
L 11/23/2015 - 07:17:03: [SM]   [0]  Line 345, gifts.sp::OnStartTouch()
L 11/23/2015 - 07:17:44: [SM] Native "Call_StartFunction" reported: Invalid function id (140)
L 11/23/2015 - 07:17:44: [SM] Displaying call stack trace for plugin "gifts.smx":
L 11/23/2015 - 07:17:44: [SM]   [0]  Line 345, gifts.sp::OnStartTouch()
L 11/23/2015 - 07:17:49: [SM] Native "Call_StartFunction" reported: Invalid function id (140)
L 11/23/2015 - 07:17:49: [SM] Displaying call stack trace for plugin "gifts.smx":
L 11/23/2015 - 07:17:49: [SM]   [0]  Line 345, gifts.sp::OnStartTouch()
L 11/23/2015 - 07:18:03: [SM] Native "Call_StartFunction" reported: Invalid function id (140)
L 11/23/2015 - 07:18:03: [SM] Displaying call stack trace for plugin "gifts.smx":
L 11/23/2015 - 07:18:03: [SM]   [0]  Line 345, gifts.sp::OnStartTouch()
L 11/23/2015 - 07:23:06: [SM] Native "Call_StartFunction" reported: Invalid function id (140)
L 11/23/2015 - 07:23:06: [SM] Displaying call stack trace for plugin "gifts.smx":
L 11/23/2015 - 07:23:06: [SM]   [0]  Line 345, gifts.sp::OnStartTouch()
L 11/23/2015 - 07:23:46: [SM] Native "Call_StartFunction" reported: Invalid function id (140)
L 11/23/2015 - 07:23:46: [SM] Displaying call stack trace for plugin "gifts.smx":
L 11/23/2015 - 07:23:46: [SM]   [0]  Line 345, gifts.sp::OnStartTouch()
itiap is offline
Send a message via AIM to itiap Send a message via Yahoo to itiap Send a message via Skype™ to itiap
pete8159
Member
Join Date: Mar 2016
Old 04-04-2016 , 22:07   Re: [ANY] Gifts!
Reply With Quote #27

Just an update. From the time i added this its causing server Lag spikes which cause the server to randomly lag out and must be restarted.
pete8159 is offline
FireBlood
Junior Member
Join Date: Jul 2016
Old 08-01-2016 , 12:59   Re: [ANY] Gifts!
Reply With Quote #28

how to put the gift card at the end of?
FireBlood is offline
RandomDued
Junior Member
Join Date: Apr 2016
Old 08-06-2016 , 08:43   Re: [ANY] Gifts!
Reply With Quote #29

Anyone have a step by step tutorial on how to add the gift model? For me it's a giant error. :/
RandomDued is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 10-29-2016 , 11:28   Re: [ANY] Gifts!
Reply With Quote #30

Not working for cs:go.
__________________


Max-Play.pl - the best polish servers
CamerDisco 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:24.


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