Raised This Month: $ Target: $400
 0% 

Problem with Weapon Chance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
orionecek
Junior Member
Join Date: Jul 2008
Old 09-05-2008 , 18:35   Problem with Weapon Chance
Reply With Quote #1

Hi, i have little problem with my Weapon chance.I am amateur in scripting and i need help:-)

Problem: Guns in game have so much bullets. Awp(10), Five7 (20),Dgl (7) scout (10).

Thanks :-)

Quote:
#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", "Doombringer");
register_logevent("round_start", 2, "1=Round_Start");

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

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) <= 100)
{
ammo = get_pcvar_num(awp_ammo);
fm_give_item(player, "weapon_awp");

new name[32];
get_user_name( player, name, 32);
ColorChat(0, RED, "[ViSioN] Bacha!Nekdo dostal AWP !!!", name);

}

if(random_num(0, 100) <= 100)
{
ammo = get_pcvar_num(fiveseven_ammo);
fm_give_item(player, "weapon_fiveseven");

new name[32];
get_user_name( player, name, 32);
ColorChat(0, RED, "[ViSioN] Bacha!Nekdo dostal FiveSeven [2Bullets]!!!", name);
}

if(random_num(0, 100) <= 100)
{
ammo = get_pcvar_num(deagle_ammo);
fm_give_item(player, "weapon_deagle");

new name[32];
get_user_name( player, name, 32);
ColorChat(0, RED, "[ViSioN] Bacha!Nekdo dostal Deagla !!!", name);
}

if(random_num(0, 100) <= 100)
{
set_pev(player, pev_health, 125.0);
ColorChat(player, GREEN, "[ViSioN] Gratulka!Dostal jsi +25HP !!!");
}



if(random_num(0, 100) <= 100)
{
ammo = get_pcvar_num(scout_ammo);
fm_give_item(player, "weapon_scout");

cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_scout"), ammo);
ColorChat(player, GREEN, "[ViSioN] Nice!Dostal jsi Scouta pro rychlejsi beh! [260norm]!!!");
}

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

ColorChat(player, GREEN, "[ViSioN] Usmalo se na tebe stesti kamo :-) +100HP !!!");
}

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

ColorChat(player, GREEN, "[ViSioN] Smula kamo!Ztratil jsi 99HP !!!");


}
}
}
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_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if (!pev_valid(ent))
return 0

new Floatrigin[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
}


Btw:Where i can download Decompilator?
orionecek is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-05-2008 , 18:42   Re: Problem with Weapon Chance
Reply With Quote #2

Scripting questions belong in Scripting Help. Moved


Search the forums and you will find one.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-05-2008 , 19:25   Re: Problem with Weapon Chance
Reply With Quote #3

http://forums.alliedmods.net/showthread.php?t=73576
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
orionecek
Junior Member
Join Date: Jul 2008
Old 09-06-2008 , 01:52   Re: Problem with Weapon Chance
Reply With Quote #4

x-olent i want weapon chcance with that

Quote:
new name[32];
get_user_name( player, name, 32);
ColorChat(0, RED, "[ViSioN] Bacha!Nekdo dostal AWP !!!", name);
U can help me?
orionecek is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-06-2008 , 03:04   Re: Problem with Weapon Chance
Reply With Quote #5

Did you even try the one I showed you?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
orionecek
Junior Member
Join Date: Jul 2008
Old 09-06-2008 , 04:33   Re: Problem with Weapon Chance
Reply With Quote #6

Yes, i think...
orionecek is offline
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 09-06-2008 , 06:59   Re: Problem with Weapon Chance
Reply With Quote #7

Someone lock this thread. You can find solution by searching with keyword "weapon chance" for fuck sake.
[X]-RayCat 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 03:07.


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