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