A problem with my getobjectpos
#1

Hey! Since i cannot seem to fix this myself i gotta ask you peeps!
Well the problem is like this, people can plant some stuff, it then evolves into a new object and people are able to take it.. But the problem is it only works for the last thing that was planted, could anybody help me out? Or give me some info about what i have to do or anything i forgot ? I really need this fixed.

This is the plant thing.
pawn Code:
new Float:wX, Float:wY, Float:wZ;
format(string, sizeof(string), "You planted a weed plant, now wait for it to grow");
SendClientMessage(playerid, COLOR_WHITE, string);
PlayerInfo[playerid][pDrugs] -= 4;
WeedPlanted[playerid] += 1;
IsReadyToPickup[playerid] = 0;
GetPlayerPos(playerid, wX, wY, wZ);
PlayerInfo[playerid][pWeedPlant] = CreateObject(3409, wX, wY, wZ-1, 0.0, 0.0, 0.0);
weedplant[playerid] += 1;
SetTimerEx("PlantedWeed",192000,false, "i", playerid);

ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,0,0,0,0,1000);
The pickup command
pawn Code:
new Float:wX, Float:wY, Float:wZ;
GetObjectPos(PlayerInfo[i][pWeedPlante], wX, wY, wZ);
if(PlayerToPoint(6, playerid, wX, wY, wZ))
{
  {
    IsReadyToPickup[playerid] = 0;
    ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,0,0,0,0,1000);
    WeedPlanted[playerid] = 0;
    weedplant[playerid] = 0;
    new rand = random(3)+4;
    new str[256];               //string
    format(str,sizeof(str),"You got %i grams weed from the plant.",rand);
                         //send the string
    SendClientMessage(playerid,COLOR_WHITE,str);
    PlayerInfo[playerid][pWeed] += rand;
    PlayerInfo[playerid][pWeedPlant] = 0;
    DestroyObject(PlayerInfo[i][pWeedPlante]);
    SetTimer("WeedDestroy",10,0);
    return 1;
  }
}


else
{
  SendClientMessage(playerid, COLOR_WHITE, "You are not near any plants, or its not ready yet.");
  return 1;
}
And the public.
pawn Code:
public PlantedWeed(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      new Float:wX, Float:wY, Float:wZ;
      GetObjectPos(PlayerInfo[playerid][pWeedPlant], wX, wY, wZ);
        PlayerInfo[playerid][pWeedPlante] = CreateObject(3409, wX, wY, wZ, 0.0, 0.0, 0.0);
      DestroyObject(PlayerInfo[playerid][pWeedPlant]);
        weedplant[playerid] = 0;
        SetTimer("WeedDestroy",425000,0);
        return 1;
    }
    return 1;
}
So now i posted what is needed, could anybody help me out ? I would really appreciate it
Reply


Messages In This Thread
A problem with my getobjectpos - by Johndaone - 25.02.2010, 23:24
Re: A problem with my getobjectpos - by Backwardsman97 - 26.02.2010, 00:16
Re: A problem with my getobjectpos - by Johndaone - 26.02.2010, 00:17
Re: A problem with my getobjectpos - by Backwardsman97 - 26.02.2010, 00:30
Re: A problem with my getobjectpos - by Johndaone - 26.02.2010, 00:35
Re: A problem with my getobjectpos - by Backwardsman97 - 26.02.2010, 00:46

Forum Jump:


Users browsing this thread: 1 Guest(s)