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

OnRoundStart problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
antal1208
Junior Member
Join Date: Mar 2016
Old 01-17-2017 , 12:25   OnRoundStart problem
Reply With Quote #1

Hi scripters!

I have problem with my plugin. I just want to set client's clan tag on round start who has CUSTOM1 flag. Compile is OK. But when i load my plugin on my cs:go server didn't work

Sry my bad english!
antal1208 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 01-17-2017 , 12:36   Re: OnRoundStart problem
Reply With Quote #2

show us your code.
Without a code we can't help you.
__________________
coding & free software
shanapu is offline
antal1208
Junior Member
Join Date: Mar 2016
Old 01-17-2017 , 12:42   Re: OnRoundStart problem
Reply With Quote #3

OMG I sry.... i working

Quote:
#include <sourcemod>
#include <cstrike>

public void OnPluginStart(){

PrintToChatAll("Vip Plugin Loaded! V1.0");
}
public void OnRoundStart()
{
PrintToChatAll("New Round Started!");
for (int i = 1; i <= MaxClients; i++) {

if (GetUserFlagBits(i) & ADMFLAG_CUSTOM1 == ADMFLAG_CUSTOM1)
{
CS_SetClientClanTag(i, "VIP");

}

}
}

Last edited by antal1208; 01-17-2017 at 12:43.
antal1208 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-17-2017 , 12:46   Re: OnRoundStart problem
Reply With Quote #4

GetUserFlagBits(i) & ADMFLAG_CUSTOM1 will return true if the client has the flag, or will return false if the client does not.
Mitchell is offline
antal1208
Junior Member
Join Date: Mar 2016
Old 01-17-2017 , 12:48   Re: OnRoundStart problem
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
GetUserFlagBits(i) & ADMFLAG_CUSTOM1 will return true if the client has the flag, or will return false if the client does not.

Hm... but sometimes my plugin change the clan tag... okay i try it! Other problem with my code?

*How can i check True Or False? Like this: GetUserFlagBits(i) & ADMFLAG_CUSTOM1 == true

Last edited by antal1208; 01-17-2017 at 12:49.
antal1208 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 01-17-2017 , 13:14   Re: OnRoundStart problem
Reply With Quote #6

just use
PHP Code:
if (GetUserFlagBits(i) & ADMFLAG_CUSTOM1)
        {
            
CS_SetClientClanTag(i"VIP"); 
        } 
__________________
coding & free software
shanapu is offline
antal1208
Junior Member
Join Date: Mar 2016
Old 01-17-2017 , 13:40   Re: OnRoundStart problem
Reply With Quote #7

Quote:
Originally Posted by shanapu View Post
just use
PHP Code:
if (GetUserFlagBits(i) & ADMFLAG_CUSTOM1)
        {
            
CS_SetClientClanTag(i"VIP"); 
        } 
PHP Code:
#include <sourcemod>
#include <cstrike>

public void OnPluginStart()
{
    
    
PrintToChatAll("Vip Plugin Loaded! V1.0");
}

public 
void OnRoundStart()    //The script doesn't go inside this...
{
    
PrintToChatAll("New Round Started!");    //Didn't wrote the server this...
    
    
for (int i 1<= MaxClientsi++) {
        
            if (
GetUserFlagBits(i) & ADMFLAG_CUSTOM1)
            {
                
CS_SetClientClanTag(i"VIP");
            }
                
        }

antal1208 is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 01-17-2017 , 13:47   Re: OnRoundStart problem
Reply With Quote #8

You need to hook the event round_start https://sm.alliedmods.net/new-api/events/HookEvent

Last edited by Kolapsicle; 01-17-2017 at 13:48.
Kolapsicle is offline
antal1208
Junior Member
Join Date: Mar 2016
Old 01-17-2017 , 13:55   Re: OnRoundStart problem
Reply With Quote #9

Quote:
Originally Posted by Kolapsicle View Post
You need to hook the event round_start https://sm.alliedmods.net/new-api/events/HookEvent
Oh nice, now works my code, but i dont now what is "HookEvent" But thx!

PHP Code:
#include <sourcemod>
#include <cstrike>

public void OnPluginStart()
{
    
HookEventEx("round_start"OnRoundStart);
    
PrintToChatAll("Vip Plugin Loaded! V1.0");
}

public 
Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)    //The script doesn't go inside this...
{
    
PrintToChatAll("New Round Started!");    //Didn't wrote the server this...
    
    
for (int i 1<= MaxClientsi++) {
        
            if ((
GetUserFlagBits(i) & ADMFLAG_CUSTOM1) == ADMFLAG_CUSTOM1)
            {
                
CS_SetClientClanTag(i"Chili VIP");
            }
                
        }

antal1208 is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 01-17-2017 , 14:48   Re: OnRoundStart problem
Reply With Quote #10

Quote:
Originally Posted by antal1208 View Post
Oh nice, now works my code, but i dont now what is "HookEvent" But thx!
You should really check out the wiki pages for things like this because it is made to teach you these concepts

Hooking an event allows you to call code whenever the event is called by the game, for example in your plugin you are hooking round_start which will get called everytime a round starts

Wiki page for events:
https://wiki.alliedmods.net/Events_(...Mod_Scripting)

List of CSGO events:
https://wiki.alliedmods.net/Counter-...fensive_Events

Last edited by Addicted.; 01-17-2017 at 14:58.
Addicted. 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 10:01.


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