AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Some problem with a plugin! (https://forums.alliedmods.net/showthread.php?t=84320)

Dann3 01-24-2009 10:04

Some problem with a plugin!
 
Hi, got some problem with "Weapon chance" plugin :wink: when i compile the plugin i get the following error code:

Warning: Loose indentation on line 14
Warning: Loose indentation on line 15

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
 
#define TASK_TIME 3.0
 
new awp_ammofiveseven_ammodeagle_ammoscout_ammoshotgun_ammoglock18_ammousp_ammoelite_ammo;
 
public 
plugin_init()
{
         
register_plugin("Plugin""Version""Author");
         
register_logevent("round_start"2"1=Round_Start");
    
         
awp_ammo register_cvar("WC_awp_ammo""1");    //This is line 14
         
fiveseven_ammo register_cvar("WC_fiveseven_ammo""2"); //This is line 15
         
deagle_ammo register_cvar("WC_50ae_ammo""1");
         
scout_ammo register_cvar("WC_762nato_ammo""0");
         
shotgun_ammo register_cvar("WC_buckshot_ammo""1");
         
glock18_ammo register_cvar("WC_9mm_ammo""3");
         
usp_ammo register_cvar("WC_45acp_ammo""2");
         
elite_ammo =register_cvar("WC_9mm_ammo""5");
    
}
public 
round_start()
{
         
set_task(TASK_TIME"give_stuff");
}
public 
give_stuff()
{
         new 
players[32], num;
         
get_players(playersnum"ah");
 
         new 
player;
         new 
ammo;
 
         for(new 
0numi++)
         {
         
player players[i];
    
    
         
         if(
random_num(0100) <= 1)
         {
                 
ammo get_pcvar_num(awp_ammo);
                 
fm_give_item(player"weapon_awp");
 
                 
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_awp"), ammo
                 
client_print(playerprint_chat,"Fett med tur, du fick AWP!"ammo)
    }

         if(
random_num(0100) <= 15)
         {
                 
ammo get_pcvar_num(fiveseven_ammo);
                 
fm_give_item(player"weapon_fiveseven");
 
                 
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_fiveseven"), ammo);
                 
client_print(playerprint_chat,"Du fick en fiveseven!");
         }
 
         if(
random_num(0100) <= 5)
         {
                
ammo get_pcvar_num(deagle_ammo);
                
fm_give_item(player"weapon_deagle");
 
                
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_deagle"), ammo);
                
client_print(playerprint_chat,"Du fick en deagle!");
         }
 
         if(
random_num(0100) <= 15)
         {
                 
fm_give_item(player"weapon_smokegrenade");
                 
client_print(playerprint_chat,"Du fick en frysgranat!");
         }
 
         if(
random_num(0100) <= 15)
         {
                  
ammo get_pcvar_num(scout_ammo);
                  
fm_give_item(player"weapon_scout");
 
                  
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_scout"), ammo);
                  
client_print(playerprint_chat,"Du fick en scout nu kan du springa lite snabbare!");
         }
 
         if(
random_num(0100) <= 14)
         {
                  
fm_give_item(player"weapon_hegrenade");
                  
client_print(playerprint_chat,"Du fick en HE!");
         }

         if(
random_num(0100) <= 10)
         {
                 
ammo get_pcvar_num(shotgun_ammo)
                 
fm_give_item(player"weapon_xm1014")
            
                 
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_xm1014"), ammo)
                 
client_print(playerprint_chat,"Du fick en shotgun!");
         }      
  
         if(
random_num(0100) <= 23)
         {
                 
ammo get_pcvar_num(glock18_ammo)
                 
fm_give_item(player"weapon_glock18")
            
                 
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_glock18"), ammo)
                 
client_print(playerprint_chat,"Du fick en glock!!");
         }

         if(
random_num(0100) <= 25)
         {
                 
ammo get_pcvar_num(usp_ammo)
                 
fm_give_item(player"weapon_usp")
            
                 
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_usp"), ammo)
                 
client_print(playerprint_chat,"Du fick en USP!");
         }   
        
         if(
random_num(0100) <= 10)
         {
                 
ammo get_pcvar_num(elite_ammo)
                 
fm_give_item(player"weapon_elite")
            
                 
cs_set_weapon_ammo(fm_get_weapon_id(player"weapon_elite"), ammo)
                 
client_print(playerprint_chat,"Du fick duals!!");
         } 
    }
}
stock fm_give_item(index, const item[]) {
         if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
         return 
0
 
         
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem));
         if (!
pev_valid(ent))
             return 
0
 
         
new Float:origin[3]
         
pev(indexpev_originorigin)
         
set_pev(entpev_originorigin)
         
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
}
stock fm_get_weapon_id(index, const weapon[])
{
         new 
ent = -1;
 
         while((
ent engfunc(EngFunc_FindEntityByStringent"classname"weapon)) != 0)
         {
              if(
index == pev(entpev_owner))
                  return 
ent;
         }
         return 
0;



Owyn 01-24-2009 13:31

Re: Some problem with a plugin!
 
just ignore that, tell if you have any errors in game with plugin

SnoW 01-24-2009 14:17

Re: Some problem with a plugin!
 
Loose identitation is in almost all cases like you are just missing a tab somewhere, it won't effect to the plugin. Still don't know about ignoring them, check the line and put the tab there, so it's more perfect.

Exolent[jNr] 01-24-2009 18:22

Re: Some problem with a plugin!
 
I don't know why you people insist on creating your own weapon chance plugins.
Mine supports all weapons and more, with cvars to customize anything you would desire.

http://forums.alliedmods.net/showthread.php?t=73576


All times are GMT -4. The time now is 01:41.

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