Hi, i've been trying to the last 4 hours or so just to get setting player money to work. I've got a plugin that sets up a standard competitive game howevery my plugin decides half times. So mp_halftime 0 is on. This means I
have to set the money of clients every half time back to 800.
Currently the following code isn't working how it's supposed to. What happens is the first time I join the server, my money gets set to 169. However when I play the game and a new round starts, I spawn in and my money doesn't get set, the function does get called.
Code:
HookEvent("player_spawn", onPlayerSpawn);
Code:
public onPlayerSpawn(Handle:event, String:strName[], bool:bDontBroadcast) {
new client = GetClientOfUserId(GetEventInt(event, "userid"));
SetEntProp(client, Prop_Send, "m_iAccount", 169);
}
other code found online that DOESN'T work, does the same as described above.
Code:
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new g_iAccount;
g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
SetEntData(client, g_iAccount, moneyAmount);