forward GivePlayerCash(playerid,dinero);
public GivePlayerCash(playerid,dinero)
{
SetPVarInt(playerid, "MoneyP", GetPlayerMoney(playerid)+dinero);
return GivePlayerMoney(playerid,dinero);
}
public OnPlayerMoneyChange(playerid, amount, totalamount)
{
if(GetPlayerMoney(playerid) >= GetPVarInt(playerid, "MoneyP"))
{
ResetPlayerMoney(playerid);
GivePlayerCash(playerid,GetPVarInt(playerid, "MoneyP"));
}
return 1;
}
public OnGameModeInit()
{
SetTimer("Anticheat",1000,true);
return 1;
}
forward GivePlayerCash(playerid,dinero);
public GivePlayerCash(playerid,dinero)
{
SetPVarInt(playerid, "MoneyP", GetPlayerMoney(playerid)+dinero);
GetPVarInt(playerid,"MoneyP");
return GivePlayerMoney(playerid,dinero);
}
forward Anticheat();
public Anticheat()
{
for(new Todos = 0; Todos < 500; Todos++)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerMoney(Todos) != GetPVarInt(playerid, "MoneyP"))
{
ResetPlayerMoney(playerid);
GivePlayerCash(playerid,GetPVarInt(playerid, "MoneyP"));
}
}
}
return 1;
}
la verdad pregunto por que yo nose mucho de pawn, quiero evitar bugs, ї crees que esta bien el codigo ?.
|
public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid) || !IsPlayerNPC(playerid)) return 0;
if (GetPlayerMoney(playerid) != GetPVarInt(playerid, "MoneyP"))
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,GetPVarInt(playerid, "MoneyP"));
}
return 1;
}