Raised This Month: $ Target: $400
 0% 

write own inc's


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-04-2010 , 04:53   write own inc's
Reply With Quote #1

hi,

idk which title i have to use.
i'm writing a new jailmod and want to check if is my freeday manager running on server and if yes, give the Leader acces to use the new effects in new plugin.

in freeday manager i have something like :

player_is_leader[id] <

do you have any ideas how can i catch the leader in new plugin?

here link of plugin http://forums.alliedmods.net/showthread.php?t=117343
PS. if is there noway, i will attach a new plugin as freedaymanager to catch the leader.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 03-04-2010 , 05:07   Re: get users info
Reply With Quote #2

Register a native in your main plugin and return the value of g_player_is_leader.

Code:
public plugin_natives( ) {     register_native( "is_player_leader", "_is_player_leader" ); } public bool:_is_player_leader( iPlugin, iParams ) {     return g_player_is_leader[ get_param( 1 ) ]; }

Then make an include file and add this:

Code:
#if defined _jail_manager_included     #endinput #endif #define _jail_manager_included native bool:is_player_leader( const id );

Then after that is done you just have to include the .inc file to your sub-plugin.

Examples how to check:
Code:
#include < jail_manager > public function( id ) {     if( is_player_leader( id ) )     {         // player is leader     }     else     {         // not leader     } }
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 03-05-2010 at 04:36. Reason: fixt
Xellath is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-04-2010 , 07:01   Re: get users info
Reply With Quote #3

awesome. ty.
i tough its imposs

now i can upload more plugins

and how is it to register a function in inc?

i mean for example i have in the main plugin :

public show_me_the_scores(id,test,test2)

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-05-2010 , 04:23   Re: get users info
Reply With Quote #4

sry for push or dubble post.

i tried to check it in csdm or zp inc but couldnt find anything which can help me.

main plugin/test1.amxx
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <jail_manager>

#define TASK_PLAYERFREE 1000

new g_tempid,g_MaxPlayers,g_leach_cvar,bool:g_player_is_leader[33],iPlayers32 ], iNum,g_printed,we_have_a_leader,gVoteMenu,
gVotes[2],gVoting,g_delay,g_percent,bool:g_Vote_Player[33],g_voted,g_free_vote,g_its_freeday,g_rounds,g_had_freeround,can_vote,
g_vote_round_number,g_let_be_freeday,g_vote_canceled,g_vip_admin,g_show_votes,g_welcomed[33],admin_gave_freeday,g_welcome_menu


public plugin_natives( ) 
{     
    
register_native"is_player_leader""_is_player_leader"); 

public 
bool:_is_player_leaderiPluginiParams 
{     
    return 
g_player_is_leaderget_param) ]; 

inc file =
PHP Code:
#if defined _jail_manager_included
    #endinput
#endif
#define _jail_manager_included

native is_player_leader( const id ); 
sub-plugin/test2.amxx
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <jail_manager>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say a","function")
    
// Add your code here...
}
public function( 
id )
{
    if( 
is_player_leaderid ) )
    {
        
// player is leader
        
client_print(id,print_chat,"jaaaaaaaaaa")
    }
    else
    {
        
// not leader
        
client_print(id,print_chat,"neiiiiiiiiiiiin")
    }

error :
PHP Code:
L 03/05/2010 10:18:25Start of error session.
L 03/05/2010 10:18:25Info (map "de_dust2") (file "addons/amxmodx/logs/error_20100305.log")
L 03/05/2010 10:18:25Wrong style of dynamic native
L 03
/05/2010 10:18:25: [AMXXDisplaying debug trace (plugin "test1.amxx")
L 03/05/2010 10:18:25: [AMXXRun time error 10native error (native "get_param")
L 03/05/2010 10:18:25: [AMXX]    [0test1.sma::_is_player_leader (line 19)
L 03/05/2010 10:18:25Unhandled dynamic native error 
i tried to search and found more topics like http://forums.alliedmods.net/showthread.php?t=118049 but the same resault. (all are the same )
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 03-05-2010 , 04:38   Re: get users info
Reply With Quote #5

Fixed my post above.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-05-2010 , 04:44   Re: get users info
Reply With Quote #6

ty its working but idk how to call a function.

main plugin function :

player_menu(id)

i want to call this function in sub plug

so i think it's last post about this.

i cant find any tuts for it or how i can make own inc

oh && get the names of plugins which use the same inc.

i want to show it in welcome menu like :

main plugin = freeday manager
subs = test1
subs = test2

in welcome menu :

this server is using : freeday manager,test1 and test2 .

something like this
__________________

Last edited by One; 03-05-2010 at 04:50.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 03-05-2010 , 07:07   Re: write own inc's
Reply With Quote #7

[COLOR=#000000]public bool:_is_player_leader( iPlugin, iParams )
{
return
g_player_is_leader[ get_param( 1 ) ];
}


should be is_player_leader not _is_player_leader, and try to add this line
in your inc file

#pragma reqlib <library>
library - your library name


__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-05-2010 , 07:33   Re: get users info
Reply With Quote #8

Quote:
Originally Posted by One View Post
ty its working but idk how to call a function.

main plugin function :

player_menu(id)

i want to call this function in sub plug

so i think it's last post about this.

i cant find any tuts for it or how i can make own inc

oh && get the names of plugins which use the same inc.

i want to show it in welcome menu like :

main plugin = freeday manager
subs = test1
subs = test2

in welcome menu :

this server is using : freeday manager,test1 and test2 .

something like this
Forwards
__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-05-2010 , 08:23   Re: write own inc's
Reply With Quote #9

ty. i tried to read the tut but...

please dont lol @ me

main plugin :
PHP Code:
public showing_menu(id)
{
    new 
szMenuName[32]
    
formatex(szMenuName31"\y%L"id"MENU_HEADER")
    new 
menu menu_create(szMenuName"free_choosed")
    new 
players[32], pnum
    
new szName[32], szTempid[10]
    
get_players(playerspnum)
    
    new 
Temp[32]
    
formatex(Temp31"\w%L"id"FFA");
    
menu_additem(menu,Temp"1",id);
    
formatex(Temp31"\w%L"id"REMOVE");
    
menu_additem(menu,Temp"2"id);
    
    
formatex(Temp31"\w%L"id"VOTE");
    
menu_additem(menu,Temp"3"id);
    
    for( new 
ii<pnum;i++ )
    {
        
g_tempid players[i];
        if(
get_user_team(g_tempid) & && is_user_alive(g_tempid))
        {
            
get_user_name(g_tempidszName31)
            
num_to_str(g_tempidszTempid9)
            
menu_additem(menuszNameszTempid0)
        }
    }
    
menu_display(idmenu0)

sub plugin :

PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say a","function")
    
// Add your code here...
}
public function( 
id )
{
    if( 
is_player_leaderid ) )
    {
        
// player is leader
        
client_print(id,print_chat,"jaaaaaaaaaa")
        new 
menu CreateMultiForward("showing_menu",id)
        
ExecuteForward(menu,id)
    }
    else
    {
        
// not leader
        
client_print(id,print_chat,"neiiiiiiiiiiiin")
    }

why i cant call the function showing_menu from main plugin in sub?



Dont lol @ me
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 03-05-2010 , 09:49   Re: write own inc's
Reply With Quote #10

Quote:
Originally Posted by tuty View Post
should be is_player_leader not _is_player_leader, and try to add this line
in your inc file

#pragma reqlib <library>
library - your library name
It should be _is_player_leader, look at the native registering.

About the reqlib, that is not required unless you're running an outdated version of amxmodx.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath 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 08:46.


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