Raised This Month: $ Target: $400
 0% 

[Solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
d3athkai
Junior Member
Join Date: Jul 2009
Old 12-26-2009 , 08:52   [Solved]
Reply With Quote #1

Thanks for the help.
__________________


Last edited by d3athkai; 12-26-2009 at 22:03.
d3athkai is offline
Bigbuck
Senior Member
Join Date: Jul 2009
Old 12-26-2009 , 11:44   Re: how to random + some other qns
Reply With Quote #2

Here is some code for #1 as well as #2.

PHP Code:
int GetRandomInt(0,2)
switch (int)
{
    case 
0:
    {
        
PrintToChat("This is message a");
    }
    case 
1:
    {
        
PrintToChat("This is message b");
    }
    case 
2:
    {
        
PrintToChat("I can keep going forever!");
    }

PHP Code:
BypassAndExecuteCommand(Client"give""first_aid_kit");

/**
 * Bypasses the sv_cheats to use command
 * Thanks to Damizean
 *
 * @param: Client - The Client to execute the command on
 * @string: strCommand - The command to execute
 * @string: strParam1 - Parameter of the command
 *
 */
BypassAndExecuteCommand(ClientStringstrCommand[], StringstrParam1[])
{
    new 
Flags GetCommandFlags(strCommand);
    
SetCommandFlags(strCommandFlags & ~FCVAR_CHEAT);
    
FakeClientCommand(Client"%s %s"strCommandstrParam1);
    
SetCommandFlags(strCommandFlags);

For #3 you could either remove the cheat flag from the cvars you want them to use or if possible try and catch what they type into console and then bypass the cheat flag and execute the command. I am not sure the latter will work as I don't know if you can hook what a player types into the console.
Bigbuck is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-26-2009 , 12:13   Re: how to random + some other qns
Reply With Quote #3

Quote:
Originally Posted by d3athkai View Post
Thanks for the codes. It worked!
Also since if there are any printtohint that works like printtochatall?

PrintHintTextToAll(string, formatparams)
Dragonshadow 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 22:23.


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