18.03.2013, 00:36
Of course it's not destroying the object, look, you did
new DropObject[MAX_DROP_ITEMS];
in the command, it should be a global variable ( at the top of your script ) so when you drop the object you do like:
DropObject[i] = CreateObject....
Then you will be able to destroy it
Edit:
In your enum of DropInfo, try to add something like this "DropGunExist". Also add like "DropGunObject"
Then in your (for example) /dropgun, you'll add:
^^Those are just the basic.
new DropObject[MAX_DROP_ITEMS];
in the command, it should be a global variable ( at the top of your script ) so when you drop the object you do like:
DropObject[i] = CreateObject....
Then you will be able to destroy it
Edit:
In your enum of DropInfo, try to add something like this "DropGunExist". Also add like "DropGunObject"
Then in your (for example) /dropgun, you'll add:
pawn Код:
for(new i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][DropGunExist] == 0)
{
DropInfo[i][DropGunExist] = 1;
DropInfo[i][DropGunObject] = CreateObject(...);
//add all the other PosX,PosY,etc
}
}
CMD:recojerarma(playerid, params[])
{
new string[128];
new playername[MAX_PLAYER_NAME];
for(new i = 0; i < sizeof(DropInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
{
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
{
GetPlayerName(playerid, playername, sizeof(playername));
DestroyDynamicObject(DropInfo[i][DropGunObject]);
GiveZaiatWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
DropInfo[i][DropGunPosX] = 0.0;
DropInfo[i][DropGunPosY] = 0.0;
DropInfo[i][DropGunPosZ] = 0.0;
DropInfo[i][DropGunAmmount][0] = 0;
DropInfo[i][DropGunAmmount][1] = 0;
DropInfo[i][DropGunExist] = 0;
format(string, sizeof(string), "* %s recoje el arma del suelo.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
}
}
return 1;
}