bag system error, item can only replace the item on slop 0 - 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: bag system error, item can only replace the item on slop 0 (
/showthread.php?tid=478251)
bag system error, item can only replace the item on slop 0 -
Chrisli520 - 28.11.2013
what i want is that player can use /putin to putin their wepon in to bag. but the code makes is i type /putin, the item that on my slop 0 (bag)will change to the weapon on my hand, but not add on.
here is code
Code:
if(!strcmp(cmd, "/putin", true))
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** Login First !");
return 1;
}
if(PlayerInfo[playerid][pDuty] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "** You are not able to do so");
return 1;
}
for(new i = 0; i < 31; i++)
{
if(baoguo[playerid][i][bID] == 0)
{
new gunname[128];
new gunID = GetPlayerWeapon(playerid);
baoguo[playerid][i+1][bID] = gunID;
baoguo[playerid][i+1][bAmount] = 1;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You had put your gun %s into your bag.", gunname);
SendClientMessage(playerid, COLOR_ORANGE, string);
format(string, sizeof(string), "* %s put his gun %s into the bag.", sendername,gunname);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
//savebaoguo(playerid);
return 1;
}
}
}
}
here is the command for open my bag
Code:
if(strcmp(cmd, "/bag", true) == 0)
{
if (IsPlayerConnected(playerid))
{
if(IsPlayerConnected(playerid))
{
new string[328];
for(new i = 0; i < 31; i++)
{
if(baoguo[playerid][i][bID] != 0)
{
new ps[128];
new gunname[128];
GetWeaponName(baoguo[playerid][i][bID],gunname,128);
format(string,328,"|{FF6699}x| |name | Amount |\n");
format(ps,128,"|{FFFF66}%d| |%s | %d |\n",baoguo[playerid][i][bID],gunname,baoguo[playerid][i][bAmount]);
strcat(string, ps);
}
}
ShowPlayerDialog(playerid, 3163, DIALOG_STYLE_LIST,"Bag",string,"select","cancel");
return 1;
}
}
}