linkosc
06-27-2010, 18:30
Hello all,
Im working on a Call of Duty mod for CS 1.6 I need help with my c4 issue.
When you choose a class it removes all weapons including c4 if you are a Terrorist. Once you select your class it removes your weapons and gives you new weapons. I need it to select a random Player from the Ts and give them c4. Can anyone Help me. Here is the menu code im using so that you can see what i mean
public ChooseClass(id)
{
new menu[] = "Call Of Duty 4: Choose Class^n^n1. Assault^n2. Spec Ops^n3. Heavy Gunner^n4. Demolitions^n5. Sniper";
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|M ENU_KEY_4|MENU_KEY_5;
show_menu(id, keys, menu, -1, "menu_ChooseClass")
return PLUGIN_CONTINUE
}
public DoChooseClass(id, key)
{
if(key == 0) {
if(PlayerClass[id] == CLASS_ASSUALT) {
client_print(id, print_chat, "[Call of Duty 4] You are allready a Assault! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_ASSUALT
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_m4a1");
fm_give_item(id, "ammo_556nato");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now Assault Class!")
}
if(key == 3) {
if(PlayerClass[id] == CLASS_DEMO) {
client_print(id, print_chat, "[Call of Duty 4] You are allready Demolitions! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_DEMO
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_m3");
fm_give_item(id, "ammo_buckshot");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now Demolitions!")
}
if(key == 2) {
if(PlayerClass[id] == CLASS_HEAVYG) {
client_print(id, print_chat, "[Call of Duty 4] You are allready a Heavy Gunner! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_HEAVYG
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_m249");
fm_give_item(id, "ammo_556natobox");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now a Heavy Gunner!")
}
if(key == 4) {
if(PlayerClass[id] == CLASS_SNIPER) {
client_print(id, print_chat, "[Call of Duty 4] You are allready a Sniper! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_SNIPER
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_scout");
fm_give_item(id, "ammo_762nato");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now a Sniper!")
}
if(key == 1) {
if(PlayerClass[id] == CLASS_SPECOPS) {
client_print(id, print_chat, "[Call of Duty 4] You are allready Spec Ops! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_SPECOPS
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_mp5navy");
fm_give_item(id, "ammo_9mm");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now Spec Ops!")
}
}
Im working on a Call of Duty mod for CS 1.6 I need help with my c4 issue.
When you choose a class it removes all weapons including c4 if you are a Terrorist. Once you select your class it removes your weapons and gives you new weapons. I need it to select a random Player from the Ts and give them c4. Can anyone Help me. Here is the menu code im using so that you can see what i mean
public ChooseClass(id)
{
new menu[] = "Call Of Duty 4: Choose Class^n^n1. Assault^n2. Spec Ops^n3. Heavy Gunner^n4. Demolitions^n5. Sniper";
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|M ENU_KEY_4|MENU_KEY_5;
show_menu(id, keys, menu, -1, "menu_ChooseClass")
return PLUGIN_CONTINUE
}
public DoChooseClass(id, key)
{
if(key == 0) {
if(PlayerClass[id] == CLASS_ASSUALT) {
client_print(id, print_chat, "[Call of Duty 4] You are allready a Assault! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_ASSUALT
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_m4a1");
fm_give_item(id, "ammo_556nato");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now Assault Class!")
}
if(key == 3) {
if(PlayerClass[id] == CLASS_DEMO) {
client_print(id, print_chat, "[Call of Duty 4] You are allready Demolitions! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_DEMO
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_m3");
fm_give_item(id, "ammo_buckshot");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now Demolitions!")
}
if(key == 2) {
if(PlayerClass[id] == CLASS_HEAVYG) {
client_print(id, print_chat, "[Call of Duty 4] You are allready a Heavy Gunner! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_HEAVYG
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_m249");
fm_give_item(id, "ammo_556natobox");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now a Heavy Gunner!")
}
if(key == 4) {
if(PlayerClass[id] == CLASS_SNIPER) {
client_print(id, print_chat, "[Call of Duty 4] You are allready a Sniper! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_SNIPER
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_scout");
fm_give_item(id, "ammo_762nato");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now a Sniper!")
}
if(key == 1) {
if(PlayerClass[id] == CLASS_SPECOPS) {
client_print(id, print_chat, "[Call of Duty 4] You are allready Spec Ops! Choose something else!")
ChooseClass(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_SPECOPS
cs_set_user_money(id, 0);
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_mp5navy");
fm_give_item(id, "ammo_9mm");
fm_give_item(id, "weapon_glock18");
fm_give_item(id, "ammo_9mm");
client_print(id, print_chat, "[Call of Duty 4] You are now Spec Ops!")
}
}