Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tradescript
#2
Hey,

hope this helps ;)

Code:
local focusid = null;
if (getPlayerFocus(playerid) == -1)
{
    sendMessageToPlayer(playerid, 255, 0, 0, "You need to have someone in your focus!");
    return;
}
else
{
    focusid = getPlayerFocus(playerid);
    local playername = getPlayerName(playerid);
    local focusname = getPlayerName(focusid);
    local args = sscanf("sd", params);
    local item_id = getItemId(args[0]);
    local pos = getPlayerPosition(playerid);
    local pos2 = getPlayerPosition(focusid);
    if (getDistance3d(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) <= 400)
    {
        if (args)    //trading
        {
                if (amount >= args[1])
                {
                    removeItem(playerid, item_id, args[1]);
                    giveItem(focusid, item_id, args[1]);
                    sendMessageToPlayer(focusid, 0, 255, 0, "You have been given " +args[1]+ "x " +args[0]+ " from " +playername);
                    sendMessageToPlayer(playerid, 0, 255, 0, "You have given " +args[1]+ "x " +args[0]+ " to " +getPlayerName(focusid));
                    print(playername + " has given " + focusname + " " + args[1] + " " + args[0]);
                }
                else
                    sendMessageToPlayer(playerid, 255, 0, 0, "You don't have enough of that.");
        }
        else
            sendMessageToPlayer(playerid, 255, 0, 0, "/trade <Item_Instance> <Amount>");
    }
    else
        sendMessageToPlayer(playerid, 255, 0, 0, "The player is too far away!");
}

This is an old script of mine. It worked fine the last time i used it.
If you got some problems or have some questions, just ask away :D
Reply


Messages In This Thread
Tradescript - by Surotex - 01.09.2020, 03:23
RE: Tradescript - by Lokivir - 01.09.2020, 08:33

Forum Jump:


Users browsing this thread: 1 Guest(s)