PDA

View Full Version : /buymats command


San1
22/06/2013, 07:38 AM
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

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);

Anak
22/06/2013, 07:51 AM
Not tested by i hope this is what you needed :)

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:


//
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