Raised This Month: $82 Target: $400
 20% 

Nuclear Dawn : How to get player rank?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tontow
Junior Member
Join Date: Dec 2011
Old 12-03-2011 , 04:17   Nuclear Dawn : How to get player rank?
Reply With Quote #1

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?

Last edited by Tontow; 12-03-2011 at 04:27. Reason: wrong button when editing subject
Tontow is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-05-2011 , 08:42   Re: Nuclear awn : How to get player rank?
Reply With Quote #2

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.
__________________
Dr. McKay is offline
Tontow
Junior Member
Join Date: Dec 2011
Old 12-05-2011 , 09:37   Re: Nuclear awn : How to get player rank?
Reply With Quote #3

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 is offline
Tontow
Junior Member
Join Date: Dec 2011
Old 12-05-2011 , 15:21   Re: Nuclear Dawn : How to get player rank?
Reply With Quote #4

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 is offline
Tontow
Junior Member
Join Date: Dec 2011
Old 12-09-2011 , 07:02   Re: Nuclear Dawn : How to get player rank?
Reply With Quote #5

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;
}

Last edited by Tontow; 12-09-2011 at 07:03.
Tontow is offline
Reply


Thread Tools
Display Modes

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 17:04.


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