Raised This Month: $ Target: $400
 0% 

SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011


Post New Thread Reply   
 
Thread Tools Display Modes
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 07-20-2013 , 14:35   Re: SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011
Reply With Quote #321

Quote:
Originally Posted by Chrisber View Post
...
Make sure to check for IsClientConnected, IsClientInGame and IsPlayerAlive since player_spawn fires at least once when he joins the game (which does not make sense in any way).
...
What I have tested some time ago, player is alive
for a moment (by one tick) when spawn on server in team 0
*edit
CS:S
__________________
Do not Private Message @me

Last edited by Bacardi; 07-20-2013 at 14:40.
Bacardi is offline
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 07-20-2013 , 16:59   Re: SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011
Reply With Quote #322

Oh, man.. I thought this check prevents this. Then a client team check should do the trick. Thanks for the hint!
Chrisber is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-21-2013 , 08:39   Re: SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011
Reply With Quote #323

Quote:
Originally Posted by Root_ View Post
Why not use post spawn event?
Code:
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
I also use plugins that changing ammunition when player spawns. Instead of making a timer or a SpawnPost hook I just add EventHookMode_Post and everything is working fine for me
HookEvent defaults to using a post hook. It's still too early.

Last edited by bl4nk; 07-21-2013 at 08:39. Reason: quote post for relevance
bl4nk is offline
Ellie
Senior Member
Join Date: Apr 2013
Old 08-30-2013 , 20:17   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #324

Been using this is some plugins (though I had to edit all their sources) and seems to be working great. Many thanks. Quick question though about this:

Quote:
Originally Posted by berni View Post
Colors that are unavailable are replaced with green by default.
What do I need to change so that the unavailable color is replaced with orange instead of green?


Also, about these two:

Code:
PrintToChatAll( "%s", message );
PrintToChat(param1, "blah");
I can't get them to work. I get an argument type mismatch. How can I fix that?

Last edited by Ellie; 08-31-2013 at 06:41.
Ellie is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-31-2013 , 12:36   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #325

Quote:
Originally Posted by Ellie View Post
Been using this is some plugins (though I had to edit all their sources) and seems to be working great. Many thanks. Quick question though about this:



What do I need to change so that the unavailable color is replaced with orange instead of green?
You can use smlib_colors.games.txt.
Just put the it into your gamedata folder and put something like the following into the #default section:

Code:
"red_alternative"	"1" // 1 = orange in the color table (See: https://github.com/bcserv/smlib/blob/master/scripting/include/smlib/colors.inc#L78)
This should work.


Quote:
Originally Posted by Ellie View Post
Also, about these two:

Code:
PrintToChatAll( "%s", message );
PrintToChat(param1, "blah");
I can't get them to work. I get an argument type mismatch. How can I fix that?
Don't know, at first, those functions are not from smlib.
And you have to post more code so I can see how the used variables are defined.
But looks like either message is not a string or param1 not an integer cell.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Ellie
Senior Member
Join Date: Apr 2013
Old 08-31-2013 , 18:35   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #326

Quote:
Originally Posted by berni View Post
You can use smlib_colors.games.txt.
Just put the it into your gamedata folder and put something like the following into the #default section:

Code:
"red_alternative"    "1" // 1 = orange in the color table (See: https://github.com/bcserv/smlib/blob/master/scripting/include/smlib/colors.inc#L78)
This should work.

Ah thanks, I'll try it now. Originally I was editing the actual color.inc file and had changed all the greens in the "alternate column", then saving it and recompiling the plugins, but was still getting green anyway.




Quote:
Originally Posted by berni View Post
Don't know, at first, those functions are not from smlib.
And you have to post more code so I can see how the used variables are defined.
But looks like either message is not a string or param1 not an integer cell.

Sure, those is particular are from the connect announce plugin. This is the code:
Code:
PrintFormattedMessageToAll( String:rawmsg[301], client )
{
    decl String:message[301];
    
    GetFormattedMessage( rawmsg, client, message, sizeof(message) );
    
    PrintToChatAll( "%s", message );
}
Code:
public MenuHandler_Vote(Handle:menu, MenuAction:action, param1, param2)
{
    if (action == MenuAction_End)
    {
        CloseHandle(menu);
    }
    else if (action == MenuAction_Select)
    {
        decl String:info[32], String:name[32];
        new target;
        
        GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
        target = StringToInt(info);

        if (target == 0)
        {
           PrintToChat(param1, "[SM] %s", "Player no longer available");
        }
        else
        {
            DisplayVoteMuteMenu(param1, target);
        }
    }
}
Hope I didn't miss anything.

Edit:
Just cam across another plugin, I having a bit of trouble with. It uses this StatsPrintToChat2. Guess I can't use SMLib for that huh?

Last edited by Ellie; 08-31-2013 at 19:29.
Ellie is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 09-01-2013 , 06:48   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #327

Quote:
Originally Posted by Ellie View Post
Ah thanks, I'll try it now. Originally I was editing the actual color.inc file and had changed all the greens in the "alternate column", then saving it and recompiling the plugins, but was still getting green anyway.
Not sure, should work.

Quote:
Originally Posted by Ellie View Post
Sure, those is particular are from the connect announce plugin. This is the code:
I'm not getting the errors your posted, are you sure those errors occur in that code ?

Quote:
Originally Posted by Ellie View Post
Edit:
Just cam across another plugin, I having a bit of trouble with. It uses this StatsPrintToChat2. Guess I can't use SMLib for that huh?[URL="http://forums.alliedmods.net/showthread.php?t=115965"]
You mean with colors ? why not ? simply replace the line 11491 with that:

PHP Code:
Client_PrintToChat(Clientfalse"\x04[\x03RANK\x04] \x01%s"Message); 
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 09-01-2013 at 06:49.
berni is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 09-03-2013 , 17:10   Re: SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011
Reply With Quote #328

Quote:
Originally Posted by Chrisber View Post
Make sure to check for IsClientConnected, IsClientInGame and IsPlayerAlive since player_spawn fires at least once when he joins the game (which does not make sense in any way).
Just to clarify, the player_spawn event is fired when players gets their spectator camera at the moment they connect. They sort of spawn in the world as a spectator, even before the team selection menu. Spectators are not alive, but they still spawn (at least once).
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
Ellie
Senior Member
Join Date: Apr 2013
Old 09-05-2013 , 14:33   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #329

Quote:
Originally Posted by berni View Post
Not sure, should work.
I redid everything and now it works. The alternate colors are now orange. Guess I had missed something somewhere.

Quote:
Originally Posted by berni View Post
I'm not getting the errors your posted, are you sure those errors occur in that code ?
Yeah that is the code, but since I redid everything it works fine now, sorry for the confusion.

Quote:
Originally Posted by berni View Post
You mean with colors ? why not ? simply replace the line 11491 with that:

PHP Code:
Client_PrintToChat(Clientfalse"\x04[\x03RANK\x04] \x01%s"Message); 
For some reason I thought the colors wouldn't work on that plugin since the functions start differently. I'll try it now then thanks

One thing I not sure about is the teamcolor tag. Wherever I use it, it is printed as the alternate color. Like I was on the blue team, but the text didn't come out blue. Can you give me an example on how to use the teamcolor tag for text that should be printed to all clients?
Ellie is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 09-05-2013 , 18:00   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #330

Quote:
Originally Posted by Ellie View Post
One thing I not sure about is the teamcolor tag. Wherever I use it, it is printed as the alternate color. Like I was on the blue team, but the text didn't come out blue. Can you give me an example on how to use the teamcolor tag for text that should be printed to all clients?
You can use only one subject/team color per message. If you have already used another subject color like shown in this table, you can't use a teamcolor. It could also fail if the color is not supported, which game ?
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 09-05-2013 at 18:00.
berni 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:20.


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