Raised This Month: $51 Target: $400
 12% 

[CSGO] Problem with func_button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pepperoniego
New Member
Join Date: Aug 2020
Old 08-31-2020 , 00:10   [CSGO] Problem with func_button
Reply With Quote #1

Im using this metod: https://forums.alliedmods.net/showthread.php?t=129597 with a func_button but when I press use on it just falls down out of the map and cannot be used again.
I can see it falling becouse i have sv showimpacts on and im constantly shooting it with the negev.

Do anyone know how to solve it?

Thanks

PHP Code:
public int ButtonTest( const float origin[3], const float angles[3] ) {

    
int ent CreateEntityByName("func_button");
    if (
ent == -1
    {
        return -
1;
    }
    
DispatchKeyValue(ent"targetname""test");
    
DispatchKeyValue(ent"spawnflags""1024"); //Tried also with 1025
    
DispatchKeyValue(ent"pushdir""0 90 0"); //Tried also without this and without speed
    
DispatchKeyValue(ent"movedir""0 0 0"); //goes to "0 0 0"
    
DispatchKeyValue(ent"speed""1"); //speed 1 so i can see falling out of the map
    
DispatchSpawn(ent);
    
TeleportEntity(entoriginanglesNULL_VECTOR);
    
SetEntityModel(ent"models/props/cs_office/vending_machine.mdl");
    new 
Float:minbounds[3] = {-20.0, -20.020.0};
    new 
Float:maxbounds[3] = {20.020.040.0};
    
SetEntPropVector(entProp_Send"m_vecMins"minbounds);
    
SetEntPropVector(entProp_Send"m_vecMaxs"maxbounds);
    
SetEntProp(entProp_Send"m_nSolidType"2);
    
SetEntProp(entProp_Send"m_CollisionGroup"1);
    
int effects GetEntProp(entProp_Send"m_fEffects");
    
effects |= 32// Sets EF_NODRAW.
    
SetEntProp(entProp_Send"m_fEffects"effects);
    
PrintToChatAll("ent created");
    
HookSingleEntityOutputent"OnPressed"OnButtonPressed_funcfalse );
    
    return 
ent;
}

public 
OnButtonPressed_func(const char[] outputint callerint activatorfloat delay)
{
    
PrintToChatAll("Button Pressed");

Edit: I finally know the reason why it falls down, the movedir keyvalue is where the button is going to in relation to the map not in relation to itself, so it just goes to position 0 0 0, If I remove movedir its just the same default value(0 0 0), is there anyway to pass the origin[3] float to a string so it can be put as a keyvalue in movedir? Or is it possible to dont make the func_button move at all(tried with flag 1024 + 1, didnt work)?

Last edited by Pepperoniego; 08-31-2020 at 15:37.
Pepperoniego is offline
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 13:32.


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