AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with Weapon Chance (https://forums.alliedmods.net/showthread.php?t=77112)

orionecek 09-05-2008 18:35

Problem with Weapon Chance
 
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 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
}


Btw:Where i can download Decompilator?

YamiKaitou 09-05-2008 18:42

Re: Problem with Weapon Chance
 
Scripting questions belong in Scripting Help. Moved


Search the forums and you will find one.

Exolent[jNr] 09-05-2008 19:25

Re: Problem with Weapon Chance
 
http://forums.alliedmods.net/showthread.php?t=73576

orionecek 09-06-2008 01:52

Re: Problem with Weapon Chance
 
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?

Exolent[jNr] 09-06-2008 03:04

Re: Problem with Weapon Chance
 
Did you even try the one I showed you?

orionecek 09-06-2008 04:33

Re: Problem with Weapon Chance
 
Yes, i think...

[X]-RayCat 09-06-2008 06:59

Re: Problem with Weapon Chance
 
:roll: Someone lock this thread. You can find solution by searching with keyword "weapon chance" for fuck sake.


All times are GMT -4. The time now is 03:07.

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