13.03.2014, 07:14
Hey, Instead of me having to use the GivePlayerMoney fnction, Am I able to somehow make a setplayercash?
If anyone could do it
If anyone could do it
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;
}
SetPlayerCash
GivePlayerMoney
stock SetPlayerCash(playerid, cash)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, cash);
return 1;
}
#define SetPlayerCash(%0,%1) ResetPlayerMoney(%0), GivePlayerMoney(%0,%1)
SetPlayerCash(playerid, cash)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, cash);
}
public OnPlayerSpawn(playerid)
{
SetPlayerMoney(playerid, POCKET_MONEY); // 10000
}
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!");
}
}