AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to strip the weapons of all and give a knife? (https://forums.alliedmods.net/showthread.php?t=89767)

alan_el_more 04-10-2009 09:23

How to strip the weapons of all and give a knife?
 
Title
Thanks in advance :D

xbatista 04-10-2009 09:29

Re: How to strip the weapons of all and give a knife?
 
PHP Code:

#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
//On the top ^       ^

stock fm_strip_user_weapons(index
{
    new 
ent fm_create_entity("player_weaponstrip");
    if (!
pev_valid(ent))
        return 
0;

    
dllfunc(DLLFunc_Spawnent);
    
dllfunc(DLLFunc_Useentindex);
    
engfunc(EngFunc_RemoveEntityent);

    return 
1;


Use : fm_strip_user_weapons(index) with set_task.

alan_el_more 04-10-2009 09:37

Re: How to strip the weapons of all and give a knife?
 
Already know that stock but if the id is 0, it removes the weapons at all?

xbatista 04-10-2009 09:39

Re: How to strip the weapons of all and give a knife?
 
Don't know really :) Never tryied

fysiks 04-10-2009 09:40

Re: How to strip the weapons of all and give a knife?
 
I don't think it would. 0 is world. Use a loop to execute on all.

alan_el_more 04-10-2009 09:44

Re: How to strip the weapons of all and give a knife?
 
PHP Code:

for(new id 1id <= g_maxplayersid++)
        
fm_strip_user_weapons(id

is well?

xbatista 04-10-2009 09:46

Re: How to strip the weapons of all and give a knife?
 
YAP

xPaw 04-10-2009 11:32

Re: How to strip the weapons of all and give a knife?
 
you wanna stip guns even if user is not connected? no way

PHP Code:

for(new id 1id <= g_maxplayersid++)
        if( 
is_user_aliveid ) )
                
fm_strip_user_weaponsid ); 

-- Edit:
If you dont want loop, you could try this (not sure what it will work)
PHP Code:

stock fm_strip_weapons( ) {
    new 
iEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"player_weaponstrip"));
    
    if( !
pev_validiEntity ) )
        return 
0;
    
    
dllfuncDLLFunc_SpawniEntity );
    
dllfuncDLLFunc_UseiEntity);
    
engfuncEngFunc_RemoveEntityiEntity );
    
    return 
1;




All times are GMT -4. The time now is 02:26.

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