Deprecating a function
#1

Hello SA-MP Community

Today I added to my gamemode a security system for money, I just created a serverside variable to keep money.

pawn Code:
stock SetPlayerCash(playerid, amount)
{
    SetPVarInt(playerid, "Cash", amount);
    ForcePlayerMoneyUpdate(playerid);
    return 0;
}

stock GetPlayerCash(playerid)
{
    return GetPVarInt(playerid, "Cash");
}

stock GivePlayerCash(playerid, amount)
{
    SetPlayerCash(playerid, GetPlayerCash(playerid)+amount);
    return 0;
}

stock ResetPlayerCash(playerid)
{
    SetPlayerCash(playerid, 0);
    return 0;
}

stock ForcePlayerMoneyUpdate(playerid)
{
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, GetPlayerCash(playerid));
    return 0;
}

All working fine, but if possible I'd want to add a warning for the compiler, if for instance cause of distraction I use GivePlayerMoney in my code when I should use GivePlayerCash.
"#pragma deprecated GivePlayerMoney" doesn't work because "#pragma deprecated" has to be used before the declaration, but I can't add it in a_samp.inc because then also the system will be warned...
If you know a way to do that, thanks if not thanks anyway, It's not such an issue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)