Raised This Month: $ Target: $400
 0% 

drop item - help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
buildy
New Member
Join Date: Dec 2005
Old 12-28-2005 , 22:03   drop item - help
Reply With Quote #1

im writing a awp battle script but I keep running into problems. the problem here is that the pistol gets dropped on round start, but after a player dies it doesnt work at all when they respawn.
Attached Files
File Type: sma Get Plugin or Get Source (awp.sma - 712 views - 2.6 KB)
__________________
===================
hot shiz: x17.kwandobe.com
buildy is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-29-2005 , 09:52  
Reply With Quote #2

Try this:

Code:
#include <amxmodx> #include <cstrike> #include <fun> //================= // declare variables new players[32] new playercount, i new CsTeams:team //=================   public plugin_init() {      register_plugin("AWP Battle!", "1.0", "Buildy") // register plugin      register_logevent("round_start", 2, "0=World triggered", "1=Round_Start") //hook round start      register_event("DeathMsg", "on_Death", "a")  //hook death event      register_event("CurWeapon","pistol","be") }   public round_start() {      set_hudmessage(255, 255, 255, -1.0, 0.35, _, _, 4.3, _, _, 4)      show_hudmessage(0,"****AWP Battle****")                          // display      set_hudmessage(0, 0, 255, -1.0, -1.0, _, _, 3.7, _, _, 3)          // Awp battle      show_hudmessage(0,"Coded by:   Buildy.")                            //  greeting            server_cmd("amx_restrict on usp") // restrict weapons                  get_players(players, playercount, "a") // get list of players ids      for(i=0; i<playercount; i++)      {           //new ammo, clip, weapon = get_user_weapon(players[i], clip, ammo) // get weapon                     //if (weapon ==  16 || 17) // pistol?           //{             //team = cs_get_user_team(players[i]) // get players team             //if (team == CS_TEAM_T) // drop pistol             //{              //   client_cmd(players[i], "weapon_glock18;drop")             //} else if (team == CS_TEAM_CT)             //{              //  client_cmd(players[i], "weapon_usp;drop")             //}           //}           pistol() // remove pistol           give_item(players[i], "weapon_awp") // give everyone an awp      } }   public on_Death() {         new sPass[1]         sPass[0] = read_data(2) // player id           set_task(0.5, "spawnagain", _, sPass, 1)  // respawn         set_task(0.7, "spawnagain", _, sPass, 1)         set_task(0.7, "awp", _, sPass, 1)           // awp giveaway         pistol() } //======================== // my functions //======================== public spawnagain(sPass[]) {    spawn(sPass[0]); // spawn player by id } public awp(sPass[]) {    give_item(sPass[0], "weapon_awp") // give item awp to player by id } public pistol() {     new ammo, clip, weapon = get_user_weapon(players[i], clip, ammo) // get weapon               if (weapon ==  16 || 17) // pistol?     {         team = cs_get_user_team(players[i]) // get players team         if (team == CS_TEAM_T) // drop pistol         {             client_cmd(players[i], "weapon_glock18;drop")         } else if (team == CS_TEAM_CT)         {             client_cmd(players[i], "weapon_usp;drop")         }     } }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 12-29-2005 , 09:59  
Reply With Quote #3

Code:
if (weapon ==  16 || 17) // pistol?
needs to be
Code:
if (weapon ==  16 || weapon == 17) // pistol?
Reason: If you just have a number in an if statment it will always be true. Unless it is a 0 in which case will always be false.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-29-2005 , 10:52  
Reply With Quote #4

Ah, didn't notice that, sorry.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 15:53.


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