#include <a_samp>
new pMoney[MAX_PLAYERS];
#if defined FILTERSCRIPT
#endif
public OnPlayerConnect(playerid)
{
pMoney[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
pMoney[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cash", cmdtext, true, 10) == 0)
{
GivePlayerMoney(playerid, 5);
return 1;
}
return 0;
}
stock ResetMoney(playerid)
{
new money;
money = GetPlayerMoney(playerid);
GivePlayerMoney(playerid, money);
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerMoney(playerid) > pMoney[playerid])
{
ResetPlayerMoney(playerid);
ResetMoney(playerid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason) { pMoney[playerid] = 0; return 1; } |
#include <a_samp>
new pMoney[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
pMoney[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
pMoney[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cash", cmdtext, true, 10) == 0)
{
GivePlayerMoneyEx(playerid, 5)
return 1;
}
return 0;
}
stock ResetPlayerMoneyEx(playerid)
{
pMoney[playerid] = 0;
return ResetPlayerMoney(playerid);
}
stock GivePlayerMoneyEx(playerid, amount)
{
pMoney[playerid] += amount;
return GivePlayerMoney(playerid, amount);
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerMoney(playerid) != pMoney[playerid])
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pMoney[playerid]);
}
return 1;
}