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

[CSGO]Check free prime


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 02-04-2021 , 16:32   [CSGO]Check free prime
Reply With Quote #1

Hi, is there any command in sourcepawn to check if player has free prime - for example he is lvl 1 but already has coin?
Because I'm using plugin to check if player has prime with:
if (SteamWorks_HasLicenseForApp(client, 624820))

But it only works for players who bought csgo and not for players who don't bought csgo and has lvl higher then 21 or players who got already coin.

I already solved problem with checking lvl higher then... but I need to check if player already had prime or he has coin after he reset his lvls

Thanks for help

Last edited by Sajmooooon; 02-04-2021 at 16:41.
Sajmooooon is offline
CowGod
Senior Member
Join Date: Feb 2015
Old 02-05-2021 , 19:08   Re: [CSGO]Check free prime
Reply With Quote #2

********* discord
CowGod is offline
Send a message via Skype™ to CowGod
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 02-14-2021 , 15:25   Re: [CSGO]Check free prime
Reply With Quote #3

Searching for a way as well, instead of linking to your discord, can you give more info here?
__________________
GitHub | Discord: @azalty | Steam
azalty is offline
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 02-15-2021 , 04:48   Re: [CSGO]Check free prime
Reply With Quote #4

Quote:
Originally Posted by azalty View Post
Searching for a way as well, instead of linking to your discord, can you give more info here?
I found solution, it is possible to add every player who joined server with non-prime to database and then check if he is in database, but I'm new to sourcepawn so I have coded it yet.
Sajmooooon is offline
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 02-15-2021 , 08:17   Re: [CSGO]Check free prime
Reply With Quote #5

Quote:
Originally Posted by Sajmooooon View Post
I found solution, it is possible to add every player who joined server with non-prime to database and then check if he is in database, but I'm new to sourcepawn so I have coded it yet.
That doesn't solve the issue if they are level 1 to 20 + service medal on their first connection and haven't got their medal equipped, because as of now we CAN get the client's medal but only if it's equipped.

I understand that you're trying to minimise the impact and I should probably do that as well, but I just don't feel like creating a db for such a small thing, or even register a cookie.

I think the answer is we cannot, these are probably the best workarounds we have right now.
__________________
GitHub | Discord: @azalty | Steam
azalty is offline
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 02-15-2021 , 10:03   Re: [CSGO]Check free prime
Reply With Quote #6

Quote:
Originally Posted by azalty View Post
That doesn't solve the issue if they are level 1 to 20 + service medal on their first connection and haven't got their medal equipped, because as of now we CAN get the client's medal but only if it's equipped.

I understand that you're trying to minimise the impact and I should probably do that as well, but I just don't feel like creating a db for such a small thing, or even register a cookie.

I think the answer is we cannot, these are probably the best workarounds we have right now.
Yep I think too we can't do anything else, but I didn't know about checking equipped medal, can you tell me how ? Thanks.
Sajmooooon is offline
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 02-15-2021 , 12:01   Re: [CSGO]Check free prime
Reply With Quote #7

source: eyal282 (https://forums.alliedmods.net/showthread.php?p=2617618)

Code:
// native int UsefulCommands_ApproximateClientRank(int client);

// returns approximate rank.
// Note: if client has no service medals, returns exact rank.
// Note: if client has one medal, returns exact rank ONLY if it's equipped.
// Note: if client has more than one medal, does not return exact rank, however if you wanna filter out newbies, will work fine.
// Note: if you kick a client based on his rank, you should ask him to temporarily equip a service medal if he reset his rank recently, and you should cache that his steam ID is an acceptable rank.
// Note: don't use this on Counter-Strike: Source lol.

public int Native_ApproximateClientRank(Handle caller, int numParams)
{	
	int PlayerResourceEnt = GetPlayerResourceEntity();
	
	int client = GetNativeCell(1);
	
	if(!IsClientInGame(client))
	{
		ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %i", client);
		return -1;
	}
	
	char sCoin[64], value, rank = GetEntProp(PlayerResourceEnt, Prop_Send, "m_nPersonaDataPublicLevel", _, client);
	IntToString(GetEntProp(PlayerResourceEnt, Prop_Send, "m_nActiveCoinRank", _, client), sCoin, sizeof(sCoin));
	
	if(rank == -1)
		rank = 0;
		
	if(GetTrieValue(Trie_CoinLevelValues, sCoin, value))
		rank += value;
	
	return rank;
}
The trie contains service medals' IDs I guess, just look at the original plugin
__________________
GitHub | Discord: @azalty | Steam
azalty is offline
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 02-15-2021 , 12:27   Re: [CSGO]Check free prime
Reply With Quote #8

Quote:
Originally Posted by azalty View Post
source: eyal282 (https://forums.alliedmods.net/showthread.php?p=2617618)

Code:
// native int UsefulCommands_ApproximateClientRank(int client);

// returns approximate rank.
// Note: if client has no service medals, returns exact rank.
// Note: if client has one medal, returns exact rank ONLY if it's equipped.
// Note: if client has more than one medal, does not return exact rank, however if you wanna filter out newbies, will work fine.
// Note: if you kick a client based on his rank, you should ask him to temporarily equip a service medal if he reset his rank recently, and you should cache that his steam ID is an acceptable rank.
// Note: don't use this on Counter-Strike: Source lol.

public int Native_ApproximateClientRank(Handle caller, int numParams)
{	
	int PlayerResourceEnt = GetPlayerResourceEntity();
	
	int client = GetNativeCell(1);
	
	if(!IsClientInGame(client))
	{
		ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %i", client);
		return -1;
	}
	
	char sCoin[64], value, rank = GetEntProp(PlayerResourceEnt, Prop_Send, "m_nPersonaDataPublicLevel", _, client);
	IntToString(GetEntProp(PlayerResourceEnt, Prop_Send, "m_nActiveCoinRank", _, client), sCoin, sizeof(sCoin));
	
	if(rank == -1)
		rank = 0;
		
	if(GetTrieValue(Trie_CoinLevelValues, sCoin, value))
		rank += value;
	
	return rank;
}
The trie contains service medals' IDs I guess, just look at the original plugin
Ok, thanks
Sajmooooon 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:15.


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