SA-MP Forums Archive
Deprecating a function - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Deprecating a function (/showthread.php?tid=512366)



Deprecating a function - Sasino97 - 10.05.2014

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