Raised This Month: $ Target: $400
 0% 

Solved Buttons


Post New Thread Reply   
 
Thread Tools Display Modes
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 12-01-2017 , 13:44   Re: Buttons
Reply With Quote #11

Much appreciated, ill get back to you
maqi is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 12-01-2017 , 14:09   Re: Buttons
Reply With Quote #12

Quote:
Originally Posted by maqi View Post
Dont u think i tried hahaha

I was like, ok lets start with the first function, aaand https://www.amxmodx.org/api/fakemeta/engfunc BOOM

Quote:
And you can find examples and more detailed information on this forum
__________________
retired chump
DjSoftero is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 12-01-2017 , 14:28   Re: Buttons
Reply With Quote #13

I dont want to be rude or to fight, but if u are not gonna help please dont post. You dont need to tell me something i already know. I feel like 90% people here are paid to tell you to go search for something once you ask for the help.

Instead, something like this is just fine.
Quote:
Originally Posted by HamletEagle View Post
Read tutorials abut entities firstly. What you need to know:
-create an entity
-give it an origin
-make the entity solid
-detect touch with your entity
maqi is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 12-02-2017 , 02:20   Re: Buttons
Reply With Quote #14

You didn`t find the description of the function in wiki, so you should go to forum and search for it. I would just give the links left and right, but that`s inefficient to learn like that. By searching you come across other things, which you can find neat and use in the future.
__________________
retired chump
DjSoftero is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 12-02-2017 , 22:52   Re: Buttons
Reply With Quote #15

So i was looking around. This really helped.

- I created an Entity
- Gave it an origin
- I detected the use on my entity

But i cant seem to make it solid, i tried both SOLID_TRIGGER and SOLID_BBOX constants, In the end i just copied the code from the tut, but still no solidity of any kind

After i figure out how to make it solid, comes the hard part.
How do i save everything to a file and then spawn it on map start ( Ive never been good with files )
maqi is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-03-2017 , 04:40   Re: Buttons
Reply With Quote #16

If touch worked then the entity is most likely solid. Show some code.
__________________
HamletEagle is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-03-2017 , 07:13   Re: Buttons
Reply With Quote #17

Quote:
Originally Posted by maqi View Post
How do i save everything to a file and then spawn it on map start ( Ive never been good with files )
Here is a tutorial about writing/reading from files.
Also, here there are many tutorials: https://forums.alliedmods.net/showthread.php?t=172936

Last edited by KiLLeR.; 12-03-2017 at 07:19.
KiLLeR. is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 12-03-2017 , 07:49   Re: Buttons
Reply With Quote #18

Thanks for the tuts ill look into them after a nap and finally try to get over the fear of files

PHP Code:
public makeTimerid )
{
    
    new 
Float:origin[3];
    
pevid pev_originorigin );
    
    new 
ent engfuncEngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_button") );
    
set_peventpev_classnameg_Classname );
    
engfuncEngFunc_SetOriginentorigin );
    
engfuncEngFunc_SetModelentg_Model );
    
engfuncEngFunc_SetSizeentFloat:{-50.0,-50.0,-50.0},Float:{50.0,50.0,50.0} );
    
set_peventpev_solidSOLID_BBOX );
    
set_peventpev_ownerid );
    
    return 
PLUGIN_CONTINUE;
}

public 
fw_useentclient 
{
    new 
sClassname[32];
    
peventpev_classnamesClassnamecharsmax(sClassname) );
    
// this is just a test.
    
if ( equal sClassnameg_Classname ) )
        
client_printclientprint_chat"LOOOL" );
    
    return 
FMRES_SUPERCEDE;

Heres the code, but like i told you, after figuring everything out i just copied the code from the tut to see if I was missing something out, but nothing is physically solid ( so i can colide with it ).
maqi is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-03-2017 , 09:04   Re: Buttons
Reply With Quote #19

I'm confused, fw_Use is FM_Touch or some kind of Use event? Show your full plugin please.
__________________

Last edited by HamletEagle; 12-03-2017 at 09:04.
HamletEagle is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 12-03-2017 , 12:48   Re: Buttons
Reply With Quote #20

This is not the whole plugin, but this is everything that has to do with buttons, fw_use is a Ham_Use, but that isnt a problem

PHP Code:
#include <amxmodx>
#include <amxmisc>

#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

new const     plugin[]    =    "timer",
        
version[]    =    "1.1",
        
author[]    =    "maqi";

new 
g_Model[] = "models/drtimer/button_end.mdl";
new 
g_Classname[] = "func_timer";

public 
plugin_init() 
{
    
register_pluginpluginversionauthor );
    
    
register_concmd"amx_test" "makeTimer" );
    
    
RegisterHamHam_Use"func_button""fw_use" );
}

public 
plugin_precache()
    
precache_model(g_Model);

public 
makeTimerid )
{
    
    new 
Float:origin[3];
    
pevid pev_originorigin );
    
    new 
ent engfuncEngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_button") );
    
set_pevent,pev_classname,g_Classname );
    
engfuncEngFunc_SetOriginentorigin );
    
engfuncEngFunc_SetModel,ent,g_Model );
    
engfuncEngFunc_SetSize,ent,Float:{-50.0,-50.0,-50.0},Float:{50.0,50.0,50.0} );
    
set_pevent,pev_solid,SOLID_BBOX );
    
set_pevent,pev_owner,id );
    
    return 
PLUGIN_CONTINUE;
}

public 
fw_useentclient )
{
    new 
sClassname[32];
    
peventpev_classnamesClassnamecharsmax(sClassname) );
    
    if ( 
equal sClassnameg_Classname ) )
        
client_printclientprint_chat"LOOOL" );
    
    return 
FMRES_SUPERCEDE;

EDIT: Loool, i removed the pev_owner, because i didnt think i needed it and suddenly a crashed right into my timer nicee Looks like that is taken care of.

About files, i made files, write data to files, all is good, but i cant seem to figure out how to replace a line in a file with a new string.

Last edited by maqi; 12-03-2017 at 16:38.
maqi 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 07:18.


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