AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help! (https://forums.alliedmods.net/showthread.php?t=93516)

K.K.Lv 05-30-2009 03:46

Need Help!
 
i wrote code can remove the Bomb,
but i user
PHP Code:

set_task(time"get_c4")
===>
public 
get_cs()
{
how to write here?


to send the bomb to the T(alive) !!
i'm sorry for my bad english!!

xPaw 05-30-2009 05:57

Re: Need Help!
 
PHP Code:

// only weapon index or its name can be passed, if neither is passed then the current gun will be transferred
stock bool:fm_transfer_user_gun(index1index2wid 0, const wname[] = "") {
    new 
ent_class[32]
    if (!
wid && wname[0])
        
copy(ent_classsizeof ent_class 1wname)
    else {
        new 
weapon widclipammo
        
if (!weapon && !(weapon get_user_weapon(index1clipammo)))
            return 
false
        
        get_weaponname
(weaponent_classsizeof ent_class 1)
    }

    new 
ent_weap fm_find_ent_by_owner(-1ent_classindex1)
    if (!
ent_weap)
        return 
false

    engclient_cmd
(index1"drop"ent_class)

    new 
ent_box pev(ent_weappev_owner)
    if (!
ent_box || ent_box == index1)
        return 
false

    set_pev
(ent_boxpev_flagspev(ent_boxpev_flags) | FL_ONGROUND)
    
dllfunc(DLLFunc_Touchent_boxindex2)
    if (
pev(ent_weappev_owner) != index2)
        return 
false

    
return true



moosewanted 05-30-2009 06:08

Re: Need Help!
 
PHP Code:

public give_c4()
{
    
//code takes id from parameters and stores it in 'id'
    
if(is_user_alive(id))
    {
        
give_item(id"weapon_c4")
        
cs_set_user_plant(id11)
    }


perhaps?

Requires fun + cstrike modules though.
Also when setting the task, you must send the id of the person you want to give the bomb in the parameter

Yeh his is good ^ mines simple :p

K.K.Lv 05-30-2009 07:55

Re: Need Help!
 
thanks moosewanted!!
i will test it!!

K.K.Lv 05-30-2009 08:06

Re: Need Help!
 
hey moosewanted!!
there was something wrong!
i remove the bomb,when i was killed ,the server can't give the bomb to the T(alive)!!

K.K.Lv 05-30-2009 08:26

Re: Need Help!
 
who can help me ??
please !!!
this is my code!
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta_util>
#include <fakemeta>
#define PLUGIN_NAME "Drop or Hide the Bomb"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "K.K.Lv"
 
new g_droporhide
 
public plugin_init()
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
 
g_droporhide register_cvar("amx_drop_or_hide_bomb""1")
 
register_clcmd("drop""hookdropbomb")
}
public 
hookdropbomb(id)
{
 if (
is_user_alive(id) && get_user_weapon(id) == CSW_C4 && get_pcvar_num(g_droporhide))
 {
  new 
menubody menu_create("\ydrop bomb menu""call_menu")
 
  
menu_additem(menubody"\wdrop bomb""1"0)
  
menu_additem(menubody"\whide bomb""2"0)
 
  
menu_setprop(menubodyMPROP_EXIT0)
 
  
menu_display(idmenubody0)
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
call_menu(idmenubodyitem)
{
 if (
item == MENU_EXIT)
 {
  
menu_destroy(menubody)
  return 
PLUGIN_HANDLED
 
}
 new 
iData[6], iName[32]
 new 
iAccessiCallback
 menu_item_getinfo
(menubodyitemiAccessiData5iName31iCallback)
 
 new 
key str_to_num(iData)
 
 switch (
key)
 {
  case 
1:
  {
   
engclient_cmd(id"drop""weapon_c4")
   
menu_destroy(menubody)
   return 
PLUGIN_HANDLED
  
}
  case 
2:
  {
   
handle_c4_menu(id)
  }
 }
 
menu_destroy(menubody)
 return 
PLUGIN_HANDLED
}
handle_c4_menu(id)
{
 new 
menubody menu_create("\yHow long do you want to hide ?""display_menu")
 
 
menu_additem(menubody"\w30 seconds""1"0)
 
menu_additem(menubody"\w60 seconds""2"0)
 
menu_additem(menubody"\w75 seconds""3"0)
 
menu_additem(menubody"\w90 seconds""4"0)
 
 
menu_setprop(menubodyMPROP_EXITMEXIT_ALL)
 
 
menu_display(idmenubody0)
}
public 
display_menu(idmenubodyitem)
{
 if (
item == MENU_EXIT)
 {
  
menu_destroy(menubody)
  return 
PLUGIN_HANDLED
 
}
 new 
iData[6], iName[32]
 new 
iAccessiCallback
 menu_item_getinfo
(menubodyitemiAccessiData5iName31iCallback)
 
 new 
key str_to_num(iData)
 
 switch (
key)
 {
  case 
1:
  {
   new 
iEnt fm_find_ent_by_owner(-1"weapon_c4"id)
   
engclient_cmd(id"drop""weapon_c4")
   new 
iBox pev(iEntpev_owner)
   if (!
iBox || iBox == id)
    return 
false
   dllfunc
(DLLFunc_ThinkiBox)
   
set_task(30.0"get_c4"id)
   
menu_destroy(menubody)
   return 
PLUGIN_HANDLED
  
}
  case 
2:
  {
   new 
iEnt fm_find_ent_by_owner(-1"weapon_c4"id)
   
engclient_cmd(id"drop""weapon_c4")
   new 
iBox pev(iEntpev_owner)
   if (!
iBox || iBox == id)
    return 
false
   dllfunc
(DLLFunc_ThinkiBox)
   
set_task(60.0"get_c4"id)
  }
  case 
3:
  {
   new 
iEnt fm_find_ent_by_owner(-1"weapon_c4"id)
   
engclient_cmd(id"drop""weapon_c4")
   new 
iBox pev(iEntpev_owner)
   if (!
iBox || iBox == id)
    return 
false
   dllfunc
(DLLFunc_ThinkiBox)
   
set_task(75.0"get_c4"id)
  }
  case 
4:
  {
   new 
iEnt fm_find_ent_by_owner(-1"weapon_c4"id)
   
engclient_cmd(id"drop""weapon_c4")
   new 
iBox pev(iEntpev_owner)
   if (!
iBox || iBox == id)
    return 
false
   dllfunc
(DLLFunc_ThinkiBox)
   
set_task(90.0"get_c4"id)
  }
 }
 
menu_destroy(menubody)
 return 
PLUGIN_HANDLED
}
public 
get_c4(id)
{
 if (
is_user_alive(id))
 {
  
"how to write here??"
 
}


use
PHP Code:

give_item()??? 


xPaw 05-30-2009 09:29

Re: Need Help!
 
PHP Code:

public give_c4(id)
{
    if(
is_user_alive(id))
    {
        
give_item(id"weapon_c4")
        
cs_set_user_plant(id11)
    }



K.K.Lv 05-30-2009 10:42

Re: Need Help!
 
xPaw
PHP Code:

if (!is_user_alive(id))
{
"how to write?"



xPaw 05-30-2009 11:05

Re: Need Help!
 
how to write what?:mrgreen:

K.K.Lv 05-30-2009 12:17

Re: Need Help!
 
i know this:
PHP Code:

if(is_user_alive(id)) 
    { 
        
give_item(id"weapon_c4"
        
cs_set_user_plant(id11
    } 

but
PHP Code:

if (!is_user_alive(id))
{
"who will get the bomb?" 




All times are GMT -4. The time now is 14:04.

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