SetPlayerCash - 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: SetPlayerCash (
/showthread.php?tid=500433)
SetPlayerCash -
Mriss - 13.03.2014
Hey, Instead of me having to use the GivePlayerMoney fnction, Am I able to somehow make a setplayercash?
If anyone could do it
Re: SetPlayerCash -
Jack_Leslie - 13.03.2014
pawn Код:
CMD:setplayercash(playerid, params[])
{
new targetid, cash;
if(sscanf(params, "ui", targetid, cash)) return SendClientMessage(playerid, -1, "Usage: /setplayercash [playerid] [cash]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not connected.");
PlayerInfo[targetid][Cash] = cash;
return 1;
}
Adjust variables and enums to your script.
Re: SetPlayerCash -
Bingo - 13.03.2014
This will
set player money to xxxx you entered.
This will
add the entered amount to player's current money. If you want to decrease his money then use (-)minise xxxx (-1000)
Re: SetPlayerCash -
Ceathor - 13.03.2014
It's actually pretty easy to make a function for it.
pawn Код:
stock SetPlayerCash(playerid, cash)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, cash);
return 1;
}
Quote:
Originally Posted by [vTc]Patroool
This will set player money to xxxx you entered.
This will add the entered amount to player's current money. If you want to decrease his money then use (-)minise xxxx (-1000)
|
Sorry mate, but SetPlayerCash isn't a native function...
Re: SetPlayerCash -
RoboN1X - 13.03.2014
pawn Код:
#define SetPlayerCash(%0,%1) ResetPlayerMoney(%0), GivePlayerMoney(%0,%1)
Or
pawn Код:
SetPlayerCash(playerid, cash)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, cash);
}
EDIT: Ceathor beat me.
Re: SetPlayerCash -
Ceathor - 13.03.2014
Quote:
Originally Posted by Robo_N1X
pawn Код:
#define SetPlayerCash(%0,%1) ResetPlayerMoney(%0), GivePlayerMoney(%0,%1)
Or
pawn Код:
SetPlayerCash(playerid, cash) { ResetPlayerMoney(playerid); GivePlayerMoney(playerid, cash); }
EDIT: Ceathor beat me.
|
forum.sa-mp.com: Where developers stand in line to help you!
Re: SetPlayerCash -
Mriss - 13.03.2014
Thanks Creathor, Repped
Re: SetPlayerCash -
iFarbod - 13.03.2014
yes i made some functions like this early :
http://pastebin.com/6j5wfVt9
Stock Functions :
GivePlayerHealth(playerid, Float:health)
GivePlayerArmour(playerid, Float:armour)
GivePlayerScore(playerid, score)
SetPlayerMoney(playerid, money)
GivePlayerWantedLevel(playerid, level)
Re: SetPlayerCash -
iFarbod - 13.03.2014
Here are some examples :
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerMoney(playerid, POCKET_MONEY); // 10000
}
OR :
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid)) {
GivePlayerHealth(killerid, 50);
SendClientMessage(killerid, COLOR_SUCCESS, "Great! you killed a person and earn 50 HP!");
}
}