Drop Guns error -
Rhino - 17.03.2013
Hi I have a problem with a FS "Drop Gun"
When I try to pick the gun is on the floor, the object this is not destroyed nor gives me the gun
Код HTML:
CMD:recojerarma(playerid, params[])
{
new string[128];
new playername[MAX_PLAYER_NAME];
new DropObject[MAX_DROP_ITEMS];
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(DropObject[i]);
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;
GiveZaiatWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
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;
}
It is a FS that was around here that the forum agrege and modify.
If you know how to fix it would be fantastic : D
My inglish is very bad, because I speak spanish xd
Re: Drop Guns error -
kamzaf - 17.03.2013
first of all whats: GiveZaiatWeapon?
Respuesta: Drop Guns error -
Rhino - 17.03.2013
It is a stock of GM , ignores equally I tried GivePlayerWeapon and remained the same
Respuesta: Drop Guns error -
Rhino - 17.03.2013
Help me plis :/
Re: Drop Guns error -
kamzaf - 17.03.2013
Код:
GiveZaiatWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
this line is supposed to be before:
Код:
DestroyDynamicObject(DropObject[i]);
Respuesta: Drop Guns error -
Rhino - 17.03.2013
It did not work, but do not think that is the reason :/
Re: Drop Guns error -
lelemaster - 18.03.2013
The reason is that you reset all the values before even giving the weapon to the player.
Try this:
pawn Код:
CMD:recojerarma(playerid, params[])
{
new string[128];
new playername[MAX_PLAYER_NAME];
new DropObject[MAX_DROP_ITEMS];
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(DropObject[i]);
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;
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;
}
Respuesta: Drop Guns error -
Rhino - 18.03.2013
Yeah! finally it works ... but the object is not destroyed .. :/
Re: Drop Guns error -
lelemaster - 18.03.2013
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:
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;
}
^^Those are just the basic.
Respuesta: Drop Guns error -
Rhino - 18.03.2013
Thank You ! tomorrow I test this code !