SA-MP Forums Archive
giving money to a player - 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: giving money to a player (/showthread.php?tid=583926)



giving money to a player - facekche - 31.07.2015

So I want to give money to a player automatically when he dies, meaning I want to save it into his variable right away so nobody can hack money. I could use GivePlayerMoney to give a player the money then when he disconnects I can save it to the variable but I don't know how to save it into a variable directly.

If you don't understand what I'm asking by now, I'm trying to add, for example, 500$ directly to the killer's money variable (PlayerInfo[killerid][Money]) so technically he wouldn't even see his money increase.. How would I do that?

public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
SendDeathMessage(killerid, playerid, reason);
return 1;
}


Re: giving money to a player - ikey07 - 31.07.2015

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid))
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[killerid][Money] += 1000; //the amount you want to give.
ResetPlayerMoney(killerid);
GivePlayerMoney(killerid,PlayerInfo[killerid][Money]);
}
return 1;
}



Re: giving money to a player - facekche - 31.07.2015

thanks homie