AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [CSGO]Check free prime (https://forums.alliedmods.net/showthread.php?t=330453)

Sajmooooon 02-04-2021 16:32

[CSGO]Check free prime
 
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 :oops:

CowGod 02-05-2021 19:08

Re: [CSGO]Check free prime
 
********* discord

azalty 02-14-2021 15:25

Re: [CSGO]Check free prime
 
Searching for a way as well, instead of linking to your discord, can you give more info here?

Sajmooooon 02-15-2021 04:48

Re: [CSGO]Check free prime
 
Quote:

Originally Posted by azalty (Post 2736923)
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.

azalty 02-15-2021 08:17

Re: [CSGO]Check free prime
 
Quote:

Originally Posted by Sajmooooon (Post 2736973)
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.

Sajmooooon 02-15-2021 10:03

Re: [CSGO]Check free prime
 
Quote:

Originally Posted by azalty (Post 2736987)
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.

azalty 02-15-2021 12:01

Re: [CSGO]Check free prime
 
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

Sajmooooon 02-15-2021 12:27

Re: [CSGO]Check free prime
 
Quote:

Originally Posted by azalty (Post 2737019)
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 :oops:


All times are GMT -4. The time now is 10:46.

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