Raised This Month: $32 Target: $400
 8% 

[CS:GO] i can't get my "vip start items" plugin to work (Please help me)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NATroutter
Junior Member
Join Date: Feb 2017
Old 09-18-2017 , 15:04   [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #1

i try to make plugins What gives one tagrenade and healthshot for vip players who have flag a

i already try to make that plugin but i don't know why my plugin don't work
please help me

My Script:

Code:
#include <sourcemod>
#include <sdktools>

public Plugin:myinfo = 
{
	name = "VipStartItems",
	author = "NATroutter",
	description = "Gives special items for vip players",
	version = "1.0",
	url = "http://NATroutter.net"
}

public OnPluginStart() 
{
	HookEvent("player_spawn", OnPlayerSpawn);
}

public OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new id=GetClientOfUserId(GetEventInt(event,"userid"))
	
	if (GetUserFlagBits(id) & (ADMFLAG_RESERVATION | ADMFLAG_RESERVATION) == (ADMFLAG_RESERVATION | ADMFLAG_RESERVATION))
	{
		PrintToChat(id, " \x08[\x0FSM\x08]\x09 you received vip items :)");
		GivePlayerItem(id, "weapon_tagrenade");
		GivePlayerItem(id, "weapon_healthshot");
	}
}
NATroutter is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 09-18-2017 , 16:27   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #2

It:
PHP Code:
    if (GetUserFlagBits(id) & (ADMFLAG_RESERVATION ADMFLAG_RESERVATION) == (ADMFLAG_RESERVATION ADMFLAG_RESERVATION)) 
looks strange, let's just try:
PHP Code:
if (GetUserFlagBits(id) & ADMFLAG_RESERVATION
And there's version with new syntax
PHP Code:
#include <sourcemod>
#include <sdktools>

public Plugin myinfo 
{
    
name "VipStartItems",
    
author "NATroutter",
    
description "Gives special items for vip players",
    
version "1.0",
    
url "http://NATroutter.net"
}

public 
void OnPluginStart() 
{
    
HookEvent("player_spawn"OnPlayerSpawn);
}

public 
Action OnPlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int id GetClientOfUserId(event.GetInt("userid"));
    
    if (
GetUserFlagBits(id) & ADMFLAG_RESERVATION)
    {
        
PrintToChat(id" \x08[\x0FSM\x08]\x09 you received vip items :)");
        
GivePlayerItem(id"weapon_tagrenade");
        
GivePlayerItem(id"weapon_healthshot");
    }

__________________


Max-Play.pl - the best polish servers

Last edited by CamerDisco; 09-18-2017 at 16:28.
CamerDisco is offline
NATroutter
Junior Member
Join Date: Feb 2017
Old 09-21-2017 , 07:30   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #3

Thanks for you help but that don't work i don't get any items on round start
but plugin is loaded
NATroutter is offline
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 09-21-2017 , 10:12   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #4

Any server logs?
There's most likely something in the server console when a VIP spawn.

My guess would be that this
PHP Code:
int id GetClientOfUserId(event.GetInt("userid")); 
Should be this
PHP Code:
int id GetClientOfUserId(GetEventInt(event"userid")); 
Edit:
Also, you might want to hook the event with EventHookMode_PostNoCopy just to be safe
__________________

Last edited by condolent; 09-21-2017 at 10:14.
condolent is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 09-21-2017 , 11:25   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #5

Quote:
Originally Posted by condolent View Post
Any server logs?
There's most likely something in the server console when a VIP spawn.

My guess would be that this
PHP Code:
int id GetClientOfUserId(event.GetInt("userid")); 
Should be this
PHP Code:
int id GetClientOfUserId(GetEventInt(event"userid")); 
Edit:
Also, you might want to hook the event with EventHookMode_PostNoCopy just to be safe
There is not difference between GetEventInt and event.GetInt just that the with the second way you are using the methodmaps.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
NATroutter
Junior Member
Join Date: Feb 2017
Old 09-23-2017 , 02:23   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #6

Okay i't work now but i have one problem yet if i have flag a i get thous items but if i have only z flag i don't get thous items i want them to get if you have some flags if you don't have any flags you don't get thous items

(In short: now only vips get thous but i want to vips/admins can get thous items)
NATroutter is offline
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 09-23-2017 , 06:33   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #7

Quote:
Originally Posted by NATroutter View Post
Okay i't work now but i have one problem yet if i have flag a i get thous items but if i have only z flag i don't get thous items i want them to get if you have some flags if you don't have any flags you don't get thous items

(In short: now only vips get thous but i want to vips/admins can get thous items)
PHP Code:
if (GetUserFlagBits(id) & ADMFLAG_RESERVATION || GetUserFlagBits(id) & ADMFLAG_ROOT
__________________
condolent is offline
NATroutter
Junior Member
Join Date: Feb 2017
Old 09-24-2017 , 00:28   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #8

Quote:
Originally Posted by condolent View Post
PHP Code:
if (GetUserFlagBits(id) & ADMFLAG_RESERVATION || GetUserFlagBits(id) & ADMFLAG_ROOT
i have already try that but it not work is is possible because is have in admins_simple.ini flag "99:z" i'm pretty sure that it is not because of it
NATroutter is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 09-24-2017 , 09:25   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #9

Use CheckCommandAccess instead
hmmmmm is offline
NATroutter
Junior Member
Join Date: Feb 2017
Old 09-25-2017 , 04:19   Re: [CS:GO] i can't get my "vip start items" plugin to work (Please help me)
Reply With Quote #10

Quote:
Originally Posted by hmmmmm View Post
Use CheckCommandAccess instead
i'm an idiot i don't now know how to use it
can you write some example for me
NATroutter 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 04:55.


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