Secound Problem - 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: Secound Problem (
/showthread.php?tid=456682)
CMD dosnt work properly -
Pk93 - 06.08.2013
Had some problems with my script but works better now the error now is when i use the commands and the player uses /accept steel he accepts the steel and the money removes from the player and the other player recives the money. but he dosnt get any Steels :S if someone have knowledge about this please let me now
Код:
CMD:teststeel(playerid, params[])
{
new id, amount,price;
if(sscanf(params,"udd",id,amount,price)) return SyntaxMSG(playerid, "/sellsteel [playerid/PartOfName] [amount] [price]");
if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
if(id == playerid) return SCM(playerid, COLOR_WHITE, "You cannot offer yourself.");
if(!PlayerNearPlayer(3.0, playerid, id)) return NotNearPlayerMSG(playerid);
if(price > 2000 || price < 1) return SCM(playerid, COLOR_GREY, "The price must be between $1-$2,000.");
if(GetCash(id) < price) return SCM(playerid, COLOR_WHITE, "This player has no money.");
SetIntVar(id, "SteelPrice", price);
SetIntVar(id, "SteelFrom", playerid);
SCMEx(id, COLOR_WHITE, "* %s offers you steels for $%d, /accept steel if you want.", GetName(playerid), price);
SCMEx(playerid, COLOR_WHITE, "* You have sent steel request to %s...", GetName(id));
return 1;
}
here is the cmd:accept command its not the full script i guess you wont need the full script this is everything about the steel
Код:
CMD:accept(playerid, params[])
{
new option[128];
if(sscanf(params,"s[128]",option))
{
SyntaxMSG(playerid, "/accept [option]");
SCM(playerid, COLOR_GREY, "Options: | job | faction | refill | repair | heal | steel |");
return 1;
}
if(CompareStrings(option, "steel"))
{
new amount;
new id = GetIntVar(playerid, "SteelFrom"), price = GetIntVar(playerid, "SteelPrice");
if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_INFO, "You have not been offered any steel.");
SCMEx(playerid, COLOR_WHITE, "You have bought steels for, -$%d.", price);
SCMEx(id, COLOR_WHITE, "You sold steel %s for $%d.", GetNameEx(playerid), price);
PlayerInfo[playerid][pSteel] -= amount;
PlayerInfo[id][pSteel] += amount;
GiveCash(id, price);
GiveCash(playerid, -price);
RemoveVar(playerid, "SteelPrice");
RemoveVar(playerid, "SteelFrom");
return 1;
}
Re: Secound Problem -
Pk93 - 07.08.2013
Do i need to create a new variable like this
Instead if this
Код:
PlayerInfo[playerid][pSteel] -= amount;
i make a new variable and removes [playerid]
Код:
PlayerInfo[SteelSeller][pSteel] -= amount;
like that?