Hoppa till innehåll

Compile Error


Ceto

Rekommendera inlägg

Hej alla jag har gjort eget weapon chance och jag kan inte göra så T får en hegrenade 1/3 chance och sen CT hegrenade 1/8

 

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <colorchat>

#define TASK_TIME 10.0

new gMsg_SayText;
new awp_ammo, fiveseven_ammo, deagle_ammo, scout_ammo;

public plugin_init()
{
        register_plugin("Weapon Chance", "2.3", "BunnY");
        register_logevent("round_start", 2, "1=Round_Start");

        awp_ammo = register_cvar("WC_awp_ammo", "7");
        fiveseven_ammo = register_cvar("WC_fiveseven_ammo", "20");
        deagle_ammo = register_cvar("WC_50ae_ammo", "7");
        scout_ammo = register_cvar("WC_762nato_ammo", "1");

        gMsg_SayText = get_user_msgid("SayText");  
}
public round_start()
{
        set_task(TASK_TIME, "give_stuff");
}
public give_stuff()
{
        new players[32], num;
        get_players(players, num, "ah");

        new player;
        new ammo;

        for(new i = 0; i < num; i++)
        {
        player = players[i];

        if(random_num(0, 100) <= 1)
        {
                ammo = get_pcvar_num(awp_ammo);
   42.         fm_give_item(player, "weapon_awp");
   
   44.         cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_awp"), ammo);
                ColorChat(player, GREEN, "[sG] Lucky you.. you got a awp! ( 1/100 chance )");

                new name[32];
                get_user_name( player, name, 32);
                ColorChat(0, RED, "[sG] Watch out! %s just got a awp!", name);
        }

        if(random_num(0, 50) <= 1)
        {
                ammo = get_pcvar_num(fiveseven_ammo);
   55.        fm_give_item(player, "weapon_fiveseven");

   57.         cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_fiveseven"), ammo);
                ColorChat(player, GREEN, "[sG] Lucky you.. you got a fiveseven! ( 1/50 chance )");
        }

        if(random_num(0, 55) <= 1)
        {
               ammo = get_pcvar_num(deagle_ammo);
   64.       fm_give_item(player, "weapon_deagle");

   66.        cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_deagle"), ammo);
               ColorChat(player, GREEN, "[sG] Lucky you.. you got a deagle! (1/55 chance)");
        }

        if(random_num(0, 100) <= 5)
        {
               set_pev(player, pev_health, 125.0);
               ColorChat(player, GREEN, "[sG] Lucky you.. you got a healthpack with 25hp! ( 5/100 chance )");
        }

        if(random_num(0, 8) <= 1)
        {
          new CsTeams:team = cs_get_user_team(player);
  
          if(team == CS_TEAM_CT) {
      
      82.      fm_give_item(player, "weapon_hegrenade");
                ColorChat(player, GREEN, "[sG] Lucky you.. you got a HE! ( 1/8 chance )");
          }
    }

        if(random_num(0, 30) <= 1)
        {
                cs_set_user_armor(player, 100, CS_ARMOR_VESTHELM);
                ColorChat(player, GREEN, "[sG] Lucky you.. you got a Kevlar and Helm! ( 1/30 chance )");
        }

        if(random_num(0, 45) <= 1)
        {
                 ammo = get_pcvar_num(scout_ammo);
         96.    fm_give_item(player, "weapon_scout");

         98.    cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_scout"), ammo);
                 ColorChat(player, GREEN, "[sG] Lucky you.. you got a scout to jump easier! ( 1/45 chance )");
        }

        if(random_num(0, 100) <= 2)
        {
                 set_pev(player, pev_health, 200.0);

                 ColorChat(player, GREEN, "[sG] Lucky you.. you got a healthpack with 100hp!( 2/100 chance )");
        }
    
        if(random_num(0, 3) <= 1)
        {
 new CsTeams:team = cs_get_user_team(player);
 
 if(team == CS_TEAM_T) {
 		
      115.    fm_give_item(player, "weapon_hegrenade");
                 ColorChat(player, GREEN, "[sG] Lucky you.. you got a HE! ( 1/3 chance )");
        }        
   }
}
stock fm_give_item(index, const item[]) {             121 <------
        if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
        return 0

        new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
        if (!pev_valid(ent))
            return 0

        new Float:origin[3]
        pev(index, pev_origin, origin)
        set_pev(ent, pev_origin, origin)
        set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
        dllfunc(DLLFunc_Spawn, ent)

        new save = pev(ent, pev_solid)
        dllfunc(DLLFunc_Touch, ent, index)
        if (pev(ent, pev_solid) != save)
            return ent

        engfunc(EngFunc_RemoveEntity, ent)

        return -1
}
stock fm_get_weapon_id(index, const weapon[])
{
        new ent = -1;

        while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", weapon)) != 0)
        {
             if(index == pev(ent, pev_owner))
                 return ent;
        }
        return 0;
}
stock print_green(id,const fmt[],{Float,_}:...) {
        if(id && !is_user_connected(id)) return 0

        static buffer[192]
        buffer[0] = '^x04'
        vformat(buffer[1],190, fmt,3)

        message_begin(id ? MSG_ONE : MSG_ALL,gMsg_SayText,{0,0,0},id)
        write_byte(id)
        write_string(buffer)
        message_end()

        return 1
}  

den säger att det är fel på RAD : 42,44,55,57,64,66,82,96,98,115,121,121,121,121

 

BILD : post-24323-1238513084_thumb.gif

 

Sen vill jag göra så att man kan ha random bullets (Skott) typ ( Deagle ) ( 1-7 skott ) men det ska vara lite svårt och att få 7 och det ska vara random så det kan komma 1 skott eller 2 skott eller fler. MAX 7. Sen behöver jag Heat-Seaking till t och ct men dem ska inte vara samma chans sen ska det finnas en till alla båda lagen EVERY one

 

Jag behöver hjälp väldigt snabbt. men stressa inte allt för mycket nu ;)

 

Mvh Ceto :)

Redigerat av Ceto
Länk till kommentar
Dela på andra sajter

Om du tog bort

 

42. fm_give_item(player, "weapon_awp");

44. cs_set_weapo

55. fm_give_item(player, "weapon_fiveseven");

57. cs_set_weapon_ammo(

64. fm_give_item(player, "weapon_deagle");

66. cs_set_weapon_ammo(

82. fm_give_it

96. fm_give_item(player, "weapon_scout");

98. cs_set_weapon_ammo

 

Så skulle det nog fungera mycket bättre.

Redigerat av Desajn
Länk till kommentar
Dela på andra sajter

okejj.. Jag tror knappast att alla radnummer gör så man får vapen. Snarare så du får dom roliga felmeddelandena.

 

 

För detta är inte rätt.

        ammo = get_pcvar_num(awp_ammo);
42.    fm_give_item(player, "weapon_awp");

44.    cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_awp"), ammo);
       ColorChat(player, GREEN, "[SG] Lucky you.. you got a awp! ( 1/100 chance )");

 

Det här är rätt

        ammo = get_pcvar_num(awp_ammo);
       fm_give_item(player, "weapon_awp");

       cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_awp"), ammo);
       ColorChat(player, GREEN, "[SG] Lucky you.. you got a awp! ( 1/100 chance )");

Redigerat av Desajn
Länk till kommentar
Dela på andra sajter

×
  • Skapa ny...