Help me with the sys. -
ShoortyFl - 11.04.2014
So, im doing some job on the script, but i've got a problem, so, i wanna make a system when u get close to an object and press KEY FIRE u get a attachedobject in your hand, and its all cool for the first object, but when i get to a next one, i can get an object but also it shows me a message that that object is empty right after i picked up an object, with first one its all ok, but with others..awgh.
And also, the second object wont destroy after i got close to a trunk, but with the first one everything is ok.
Код:
if(newkeys & KEY_FIRE)
{
if(!IsPlayerInAnyVehicle(playerid) && KupiSmece[playerid] == 1)
{
new Float:Pos[3];
for(new i = 0; i < sizeof(Kontenjer); i++)
{
GetDynamicObjectPos(Kontenjer[i], Pos[0],Pos[1],Pos[2]);
if(IsPlayerInRangeOfPoint(playerid,3.0,Pos[0],Pos[1],Pos[2]))
{
if(Kontenjer[i] == 999) return SCM(playerid, TOMATO, " (greska) U ovom kontenjeru vise nema smeca !");
if(Ispraznjeno[playerid] == 1) return SCM(playerid, TOMATO, " (greska) Prvo morate da ubacite smece u kontenjer !");
SetPlayerAttachedObject(playerid, 1, 1265, 6, 0.298000, -0.031999, -0.050000, 0.000000, -104.599983, 0.000000, 0.683000, 0.648999, 1.077999, 0, 0);
Kontenjer[i] = 999;
PokupljenoSmeca[playerid] ++;
Ispraznjeno[playerid] = 1;
SCMF(playerid, WHITE, " (info) Uspesno ste ubacili smece u vozilo, trenutno ste ispraznili %d od 10 kontenjera !", PokupljenoSmeca);
DestroyDynamicMapIcon(KontenjerIkona[i]);
}
}
}
if(!IsPlayerInAnyVehicle(playerid) && Ispraznjeno[playerid] == 1)
{
for(new i = 0; i < sizeof(SmecarVozila); i++)
{
new Float:Pos[3];
GetVehiclePos(SmecarVozila[i], Pos[0], Pos[1], Pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 2.0, Pos[0]+5, Pos[1], Pos[2]))
{
Ispraznjeno[playerid] = 0;
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, 1);
SCM(playerid, MAROON, " (info) Uspesno ste ubacili vrecu za smece u vozilo, molimo nastavite dalje !");
}
}
}
}
Re: Help me with the sys. -
AhmedMohamed - 11.04.2014
Try it again but after pressing key fire move to any side. it will be shown
Re: Help me with the sys. -
ShoortyFl - 11.04.2014
No it wont. The problem is that only firs object works(one that ID is 0) i tested it, and if i jump to second object it will only attach an object on him but the second key function wont work !
Re: Help me with the sys. -
ShoortyFl - 12.04.2014
Well, i just found out that problem is range of point, everytime i pickup a differend object the rangeofpoint messes up, how can i make it to work only if player is near trunk ?