/buymats command - 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: /buymats command (
/showthread.php?tid=445621)
/buymats command -
San1 - 22.06.2013
How can i make this command So it will cost 5$ per mat? also i want it to get the money before taking so it wont be negative cash. Im still designing this command so i would appreciate it if someone would help me
pawn Код:
CMD:getmats(playerid, params[])
{
new amount, str[128];;
if(PlayerInfo[playerid][pLoggedIn] == 0) return SCM(playerid, COLOR_RED, "You need to be logged in to use this command");
if(IsPlayerInRangeOfPoint(playerid,3.0,1425.4591,-1336.4163,13.5804) return SCM(playerid, COLOR_LIGHTBLUE, "You are not at the place to buy materials");
if (PlayerInfo[playerid][pJob] != 1)
{
SendClientMessage(playerid,COLOR_WHITE,"You are not an Arms Dealer!");
return 1;
}
if(sscanf(params, "i", amount)) return SCM(playerid, COLOR_WHITE, "USAGE:/buymats [amount]");
PlayerInfo[playerid][pMats] += amount;
format(string, sizeof(string), "You have purchased %d materials for %d.",amount, pay);
SCM(targetid, COLOR_RED, string);
Re: /buymats command -
Anak - 22.06.2013
Not tested by i hope this is what you needed
pawn Код:
CMD:getmats(playerid, params[])
{
new amount, str[128];;
if(PlayerInfo[playerid][pLoggedIn] == 0) return SCM(playerid, COLOR_RED, "You need to be logged in to use this command");
if(IsPlayerInRangeOfPoint(playerid,3.0,1425.4591,-1336.4163,13.5804) return SCM(playerid, COLOR_LIGHTBLUE, "You are not at the place to buy materials");
if (PlayerInfo[playerid][pJob] != 1)
{
SendClientMessage(playerid,COLOR_WHITE,"You are not an Arms Dealer!");
return 1;
}
if(sscanf(params, "i", amount)) return SCM(playerid, COLOR_WHITE, "USAGE:/buymats [amount]");
PlayerInfo[playerid][pMats] += amount;
new Float:payment = amount*5.0;//<<-- changed
GivePlayerMoney(playerid, -amount*5);//<<-- changed
format(string, sizeof(string), "You have purchased %d materials for %f.",amount, payment);//<<-- changed
SCM(targetid, COLOR_RED, string);
make sure to add this:
pawn Код:
//
new Float:payment = amount*5.0;//<<-- changed
GivePlayerMoney(playerid, -amount*5);//<<-- changed
format(string, sizeof(string), "You have purchased %d materials for %f.",amount, payment);//<<-- changed