17.09.2014, 16:16
Hello, i am creating that when a player dies he will drop his items on the ground, but its not working correctly, example, if i have just pot in inventory it drops fine when i die, but if i have both pot and crack it only drops 1 thing, same happens if i have Money,weapon,crack and pot, it will only drop one of the kinds, can you help me with this, i want it to drop everything, here is my code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new pdeathcash = GetMoney(playerid);
new deathpot = PlayerInfo[playerid][pPot];
new deathcrack = PlayerInfo[playerid][pCrack];
if(pdeathcash > 15000)
{
for(new i = 1;i < 12;i++)
{
for(i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DropInfo[i][dType] = 7;
DropInfo[i][dAmount][0] = pdeathcash - 15000;
DropInfo[i][dx] = X;
DropInfo[i][dy] = Y;
DropInfo[i][dz] = Z;
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
DropObject[i] = CreateObject(1212, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1,93.7,120.0,120.0, DropInfo[i][dWorld]);
GiveMoney(playerid,-(pdeathcash - 15000));
return 1;
}
}
}
}
if(deathpot > 10)
{
for(new i = 1;i < 12;i++)
{
for(i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DropInfo[i][dType] = 3;
DropInfo[i][dAmount][0] = deathpot - 10;
DropInfo[i][dx] = X;
DropInfo[i][dy] = Y;
DropInfo[i][dz] = Z;
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
DropObject[i] = CreateObject(1578, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1,0.00, 0.00, 0.00, DropInfo[i][dWorld]);
PlayerInfo[playerid][pPot] = 10;
return 1;
}
}
}
}
if(deathcrack > 10)
{
for(new i = 1;i < 12;i++)
{
for(i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DropInfo[i][dType] = 2;
DropInfo[i][dAmount][0] = deathcrack - 10;
DropInfo[i][dx] = X;
DropInfo[i][dy] = Y;
DropInfo[i][dz] = Z;
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
DropObject[i] = CreateObject(1575, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1,0.00, 0.00, 0.00, DropInfo[i][dWorld]);
PlayerInfo[playerid][pCrack] = 10;
return 1;
}
}
}
}
if(!IsACop(playerid) && gTeam[playerid] != 2 && PlayerInfo[playerid][pMember] != 3)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new weaponID[13], weaponammo[13], rpos[2];
for(new i = 0; i < 13; i++)
{
rpos[0] = random(4), rpos[1] = random(4);
GetPlayerWeaponData(playerid, i, weaponID[i], weaponammo[i]);
DropWeapons(weaponID[i], weaponammo[i], X + rpos[0], Y + rpos[1], Z, GetPlayerVirtualWorld(playerid), playerid);
printf("%d,%d,%f,%d,%f,%d,%f,%d,%d",weaponID[i], weaponammo[i], X, rpos[0], Y, rpos[1], Z, GetPlayerVirtualWorld(playerid), playerid);
}
}
return 1;
}