SA-MP Forums Archive
giveitem doesnt work - 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: giveitem doesnt work (/showthread.php?tid=470287)



giveitem doesnt work - Voxel - 17.10.2013

Hello guys,

I got this command:

pawn Код:
CMD:giveitem(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 6)
    {
        if(IsPlayerConnected(playerid))
        {
            new targetid,string[64],amount;
            if(sscanf(params, "is[64]", targetid,amount,string)) return SendClientMessage(playerid,-1,""chat" /giveitem [id] [amount] [item name]");
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
            {
                AddSlotToInventoryWorld(targetid,string,amount);
            }
            new str[230];
            format(str,sizeof(str),"*"COL_YELLOW" %s %s has given you "COL_WHITE"%i"COL_GREEN" %s",GetAdminName(playerid),PlayerName(playerid), amount, string);
            SendClientMessage(targetid,-1,str);
        }
    }
    return 1;
}
i get no compiling errors but in game does this:

It should say Owner Voxel has given you [amount] [item name]

and under in this picture i typed /giveitem 0 1 Test
but it didnt give me 1 test but 49 or something..



Re: giveitem doesnt work - Konstantinos - 17.10.2013

pawn Код:
CMD:giveitem(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 6)
    {
        new targetid,amount,string[64];
        if(sscanf(params, "ris[64]", targetid,amount,string)) return SendClientMessage(playerid,-1,""chat" /giveitem [id] [amount] [item name]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
        AddSlotToInventoryWorld(targetid,string,amount);
        new str[144];
        format(str,sizeof(str),"*"COL_YELLOW" %s %s has given you "COL_WHITE"%i"COL_GREEN" %s",GetAdminName(playerid),PlayerName(playerid), amount, string);
        SendClientMessage(targetid,-1,str);
    }
    return 1;
}



Re: giveitem doesnt work - Blademaster680 - 17.10.2013

Can we see the rest of the code please? "AddSlotToInventoryWorld"
We cant help with anything until we see that


Re: giveitem doesnt work - Voxel - 17.10.2013

Thank you! that worked konstantino