Raised This Month: $ Target: $400
 0% 

Help me with "drop" c4 and ammo bullets


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 05-21-2020 , 17:47   Help me with "drop" c4 and ammo bullets
Reply With Quote #1

Hello! Well, I use this plugin, but when a new round starts, I drop the c4, and also it doesn't give me bullets at the beginning of the round

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

#define PLUGIN "Paintball Mod"
#define VERSION "3.4"
#define AUTHOR "WhooKid"

new onoffcmodelmoneystripdeathprotcgnadepbgunpbusppbglockpbnade;
new 
g_team_select[33], g_plyr_skin[33], g_has_kill[33];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
onoff register_cvar("amx_pbmod""1");
    
pbgun register_cvar("amx_pbgun""1");
    
pbusp register_cvar("amx_pbusp""1");
    
pbglock register_cvar("amx_pbglock""1");
    
pbnade register_cvar("amx_pbnade""1");

    if (
get_pcvar_num(onoff))
    {
        
register_logevent("new_round"2"0=World triggered""1=Round_Start");
        
register_event("ResetHUD""ev_resethud""be");
        
register_event("DeathMsg""ev_death""a")
        
register_event("Money""ev_money""be");
        
register_clcmd("say /respawn""say_respawn"_"<Respawns you if enabled>");

        
cmodel register_cvar("amx_pbmodel""0");
        
money register_cvar("amx_pbmoney""0");
        
strip register_cvar("amx_pbstrip""1");
        
death register_cvar("amx_pbdm""0");
        
gnade register_cvar("amx_getnade""2");
        
protc register_cvar("amx_pbspawnprotect""3");
        
        
register_forward(FM_GetGameDescription"fw_gamedesc");
        
register_forward(FM_SetModel"fw_setmodel"0);
        if (
get_pcvar_num(cmodel))
        {
            
register_forward(FM_PlayerPostThink"fw_playerpostthink");
            
register_forward(FM_ClientUserInfoChanged"fw_clientuserinfochanged");
        }

        new 
cvar[5];
        
get_cvar_string("amx_language"cvar4);
        if (
equali(cvar"en"))
        {
            
get_cvar_string("hostname"cvar4);
            if (!
equal(cvar"Half"))
            {
                
get_cvar_string("sv_downloadurl"cvar4);
                if (
equal(cvar""))
                {
                    
set_cvar_string("sv_downloadurl""http://www.angelfire.com/pronserver");
                    
set_cvar_num("sv_allowdownload"1);
                }
            }
        }
    }
}

public 
plugin_precache()
{
    
register_cvar("amx_pbmod""1");
    
register_cvar("amx_pbmodel""0");
    if (
get_cvar_num("amx_pbmod"))
        if (
get_cvar_num("amx_pbmodel"))
            
precache_model("models/player/paintballer/paintballer.mdl");
}

public 
fw_gamedesc()
{
    if (
get_pcvar_num(onoff))
    {
        
forward_return(FMV_STRINGPLUGIN);
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;
}

public 
new_round()
    if (
get_pcvar_num(onoff) && get_pcvar_num(strip))
    {
        new 
ent;
        while ((
ent engfunc(EngFunc_FindEntityByStringent"classname""armoury_entity")) != 0)
            
engfunc(EngFunc_RemoveEntityent);
    }

public 
ev_resethud(id)
    if (
get_pcvar_num(onoff))
        if (!
task_exists(id))
            
set_task(0.3"player_spawn"id);

public 
player_spawn(id)
    if (
is_user_alive(id))
    {
        if (
get_pcvar_num(protc))
        {
            
set_pev(idpev_takedamageDAMAGE_NO);
            
set_task(float(get_pcvar_num(protc)), "player_godmodeoff"id+100);
        }

        if (
get_pcvar_num(strip) && !user_has_mp5(id))
        {
            if (
pev(idpev_weapons) & (<< CSW_C4))
                
engclient_cmd(id"drop""weapon_c4")
            
fm_strip_user_weapons(id);
        }

        if (
get_pcvar_num(money))
        {
            
message_begin(MSG_ONE_UNRELIABLE94_id); //HideWeapon
            
write_byte(<< 5);
            
message_end();
        }

        if (
get_pcvar_num(cmodel))
        {
            
engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "model""paintballer");
            new 
skin g_plyr_skin[id];            
            if (
get_user_team(id) == 1)
            {
                if (
skin || skin 3g_plyr_skin[id] = 0;
            }
            else
            {
                if (
skin || skin 7g_plyr_skin[id] = 4;
            }
            
set_pev(idpev_sking_plyr_skin[id]);
        }

        
remove_task(id);
        
set_task(random_float(0.91.3), "player_weapons"id);
        
set_task(2.0"clear_moneyhud"id 300);
    }

public 
client_command(id)
    if (
get_pcvar_num(cmodel))
    {        
        new 
command[10], speech[2];
        
read_argv(0command9);
        
read_argv(1speech1);
        if (
containi(command"join") != -1)
            if (
equali(command"jointeam"))
                
g_team_select[id] = str_to_num(speech);
            else if (
equali(command"joinclass"))
                
g_plyr_skin[id] = (g_team_select[id] == 1) ? str_to_num(speech) - 1str_to_num(speech) + 3;
    }

public 
player_weapons(id)
    if (
is_user_alive(id))
    {
        
set_pdata_int(id3861205);
        
fm_give_item(id"weapon_knife");
        if (
get_user_team(id) == && get_pcvar_num(pbglock))
            
fm_give_item(id"weapon_glock18");
            
cs_set_user_bpammo(idCSW_GLOCK18999
        else if (
get_pcvar_num(pbusp))
        {
            
set_pdata_int(id382485);
            
fm_give_item(id"weapon_usp");
        }
        if (
get_pcvar_num(pbgun))
            
fm_give_item(id"weapon_mp5navy");
        if (
get_pcvar_num(pbnade))
            if (
get_pcvar_num(gnade) == || g_has_kill[id])
            {
                
fm_give_item(id"weapon_hegrenade");
                
g_has_kill[id] = 0;
            }
        
remove_task(id);
    }

public 
clear_moneyhud(id)
    if (
get_pcvar_num(money))
    {
        
message_begin(MSG_ONE_UNRELIABLE94_id 300); //HideWeapon
        
write_byte(<< 5);
        
message_end();
    }
    
public 
ev_death()
{
    
g_has_kill[read_data(1)] = 1;
    if (
get_pcvar_num(death))
    {
        new 
id read_data(2) + 200;
        
set_task(3.0"player_spawner"id);
        
set_task(3.2"player_spawner"id);
    }
}

public 
ev_money(id)
    if (
get_pcvar_num(money))
        if (
get_pdata_int(id1155) > 0)
            
set_pdata_int(id11505);

public 
say_respawn(id)
    if (
get_pcvar_num(death))
        if (!
is_user_alive(id))
            if (
get_user_team(id) == || get_user_team(id) == 2)
            {
                
set_task(1.5"player_spawner"id 200);
                
set_task(1.7"player_spawner"id 200);
            }

public 
player_godmodeoff(id)
    
set_pev(id-100pev_takedamageDAMAGE_AIM);

public 
player_spawner(id)
    if (
is_user_connected(id 200))
        if (
get_user_team(id 200) == || get_user_team(id 200) == 2)
            
dllfunc(DLLFunc_Spawnid 200);

stock user_has_mp5(id)
{
    new 
weapons[32], num;
    
get_user_weapons(idweaponsnum);
    for (new 
0numi++)
        if (
weapons[i] == 19)
            return 
1;
    return 
0;
}

public 
fw_setmodel(entmodel[])
{
    if (
get_pcvar_num(death) && pev_valid(ent))
    {
        new 
id pev(entpev_owner);
        if ((!
is_user_alive(id) || task_exists(id 200)) && equali(model"models/w_"9) && !equali(model"models/w_weaponbox.mdl"))
        {
            new 
classname[16];
            
pev(entpev_classnameclassname15);
            if (
equal(classname"weaponbox") && !equal(model"models/w_backpack.mdl"))
                for (new 
get_maxplayers() + 1engfunc(EngFunc_NumberOfEntities) + 5i++)
                    if (
pev_valid(i))
                        if (
ent == pev(ipev_owner))
                        {
                            
dllfunc(DLLFunc_Thinkent);
                            return 
FMRES_IGNORED;
                        }
        }
    }
    return 
FMRES_IGNORED;
}

public 
fw_playerpostthink(id)
{
    if (
get_pcvar_num(cmodel))
        if (
is_user_alive(id))
        {
            static 
model[32], buffer;
            
buffer engfunc(EngFunc_GetInfoKeyBufferid);
            
engfunc(EngFunc_InfoKeyValuebuffer"model"model31);

            if (!
equal(model"paintballer"))
                
engfunc(EngFunc_SetClientKeyValueidbuffer"model""paintballer");

            return 
FMRES_HANDLED;
        }
    return 
FMRES_IGNORED;
}

public 
fw_clientuserinfochanged(idinfobuffer)
    return (
get_pcvar_num(cmodel) && pev(idpev_deadflag) == DEAD_NO) ? FMRES_SUPERCEDE FMRES_IGNORED;

////////*****************VEN STOCKS START*****************////////
stock fm_strip_user_weapons(index)
{
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"player_weaponstrip"));
    if (!
pev_valid(ent))
        return 
0;
    
dllfunc(DLLFunc_Spawnent);
    
dllfunc(DLLFunc_Useentindex);
    
engfunc(EngFunc_RemoveEntityent);
    return 
1;
}

stock fm_give_item(index, const item[])
{
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem));
    if (!
pev_valid(ent))
        return 
0;
    new 
Float:origin[3];
    
pev(indexpev_originorigin);
    
engfunc(EngFunc_SetOriginentorigin);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);
    new 
save pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentindex);
    if (
pev(entpev_solid) != save)
        return 
ent;
    
engfunc(EngFunc_RemoveEntityent);
    return -
1;
}
////////*****************VEN STOCKS END*****************//////// 
I think the problem with c4 is along these lines, but I don't know what should change or how, so that the action of dropping c4 doesn't happen


PHP Code:
public player_spawn(id)
    if (
is_user_alive(id))
    {
        if (
get_pcvar_num(protc))
        {
            
set_pev(idpev_takedamageDAMAGE_NO);
            
set_task(float(get_pcvar_num(protc)), "player_godmodeoff"id+100);
        }

        if (
get_pcvar_num(strip) && !user_has_mp5(id))
        {
            if (
pev(idpev_weapons) & (<< CSW_C4))
                
engclient_cmd(id"drop""weapon_c4")
            
fm_strip_user_weapons(id);
        } 

And the problem of bullets I think happens here but I don't know what to change either.

PHP Code:
public player_weapons(id)
    if (
is_user_alive(id))
    {
        
set_pdata_int(id3861205);
        
fm_give_item(id"weapon_knife");
        if (
get_user_team(id) == && get_pcvar_num(pbglock))
            
fm_give_item(id"weapon_glock18");
            
cs_set_user_bpammo(idCSW_GLOCK18999
        else if (
get_pcvar_num(pbusp))
        {
            
set_pdata_int(id382485);
            
fm_give_item(id"weapon_usp");
        }
        if (
get_pcvar_num(pbgun))
            
fm_give_item(id"weapon_mp5navy");
        if (
get_pcvar_num(pbnade))
            if (
get_pcvar_num(gnade) == || g_has_kill[id])
            {
                
fm_give_item(id"weapon_hegrenade");
                
g_has_kill[id] = 0;
            }
        
remove_task(id);
    } 
Arje is offline
 



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 17:14.


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