AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Nuclear Dawn : How to get player rank? (https://forums.alliedmods.net/showthread.php?t=173280)

Tontow 12-03-2011 04:17

Nuclear Dawn : How to get player rank?
 
I am new to sourcepawn, but I think I have most of the basics down.

I am trying to figure out how to retrieve a player's rank in Nuclear Dawn, but I have no clue on how to go about doing so.
Would someone Please point me in the correct direction?

Dr. McKay 12-05-2011 08:42

Re: Nuclear awn : How to get player rank?
 
I don't know if there's any API functions for Nuclear Dawn yet, but I could very well be mistaken. Typing "nuclear" into the API Reference returns nothing.

Tontow 12-05-2011 09:37

Re: Nuclear awn : How to get player rank?
 
Comp8nerd4u2 pointed out CNDPlayerResource netclass with a property of m_iPlayerRank , but that holds the general rank, I still cant find what holds the class rank after going through the SM dumps.
I don't see any arrays in the dumps that would be big enough to hold all the class ranks.

Tontow 12-05-2011 15:21

Re: Nuclear Dawn : How to get player rank?
 
Is there a way to do some kind of revers lookup on a netclass? (look it up by value)

I know the value of my rank, can I use that to look it up to find where it is stored?

Tontow 12-09-2011 07:02

Re: Nuclear Dawn : How to get player rank?
 
Below is some code that I got from comp8nerd4u2 that I ran though a loop.

The problem That I have with this code is that it will return all 0s until after a player has spawned.

Where would be a better place to get the information from? (note that I am new to sourcepawn)

Could someone point me in the correct direction?

Code:

#include <sourcemod>
#include <sdktools>
 
 
public OnPluginStart()
{
RegAdminCmd("sm_rankdebug", Command_smrankdebug, ADMFLAG_SLAY)
}
public Action:Command_smrankdebug(client, args)
{
new clientRank = -1;
new offset = 0;
 
 
while ( offset < 33)
{
clientRank = GetEntProp(FindEntityByNetclass("CNDPlayerResource"), Prop_Send, "m_iPlayerRank", 4, offset);
PrintToChatAll(" Debug Rank Info: %i", clientRank);
offset ++
}
return Plugin_Handled;
}
 
stock FindEntityByNetclass(const String:netclass[])
{
new ent;
new maxEnts = GetMaxEntities();
for (new i = MaxClients; i <= maxEnts; i++) {
if (!IsValidEntity(i)) {
continue;
}
decl String:_netclass[128];
GetEntityNetClass(i, _netclass, sizeof(_netclass));
if (strcmp(_netclass, netclass) == 0) {
ent = i;
break;
}
}
return ent;
}



All times are GMT -4. The time now is 11:14.

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