Quote:
Originally Posted by eyal282
Stock is now better.
|
That should be faster, because why use checking the FindEntityByClassname when it faster to create new and delete it
PHP Code:
stock SetClientMoney(client, money)
{
SetEntProp(client, Prop_Send, "m_iAccount", money);
int entity = CreateEntityByName("game_money");
if(entity != INVALID_ENT_REFERENCE)
{
DispatchKeyValue(entity, "AwardText", "");
DispatchSpawn(entity);
SetVariantInt(0);
AcceptEntityInput(entity, "SetMoneyAmount");
SetVariantInt(client);
AcceptEntityInput(entity, "AddMoneyPlayer");
AcceptEntityInput(entity, "Kill");
return true;
}
return false;
}
and i never had issue with giving money by the
Quote:
/**
* @brief Sets the money on a client.
*
* @param clientIndex The client index.
* @param iMoney The money amount.
**/
void AccountSetMoney(int clientIndex, int iMoney)
{
SetEntData(clientIndex, g_iOffset_PlayerAccount, iMoney, _, true);
}
|
__________________