SA-MP Forums Archive
Hy...I Need Some Help with GetPlayerObjectPos..... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Hy...I Need Some Help with GetPlayerObjectPos..... (/showthread.php?tid=67440)



Hy...I Need Some Help with GetPlayerObjectPos..... - Im_BanK - 01.03.2009

hy

iv created a /plantweed and /pickweed command but i dono how to make the /pickweed command to get my object position when i am not near The Plant.....and tell me "you are not near your plant.."

can somebody help me?

pawn Код:
if(strcmp(cmdtext, "/plantweed", true)==0)
  {
    if(PlayerInfo[playerid][pJob] != 4)
    {
     SendClientMessage(playerid, COLOR_GREY, "  You are not a Drug Dealer!");
     return 1;
    }
    if (PlayerInfo[playerid][pWeed] <= 0)
    {
     SendClientMessage(playerid, COLOR_GREY, "You don't have any weed seeds on you.");
     return 1;
    }
    new Float:X, Float:Y, Float:Z, Float:A;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
    SetObjectPos(playerid, X, Y, Z);
    Weed1 = CreateObject(3409, X, Y, Z-1.4, 0.0, 180, A+0);
    MoveObject(Weed1, X, Y, Z+0.6, 0.006);
    PlayerInfo[playerid][pWeed] -= 1;
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
    }
    PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
    SendClientMessage(playerid, 0x00800096,"The weed has been planted, now wait 10 min for the plant to grow");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "* %s Plant some weed.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    PlayerInfo[playerid][pPlantedWeed] = 1;
    PlayerInfo[playerid][pPlantedWeed] = 600;
    return 1;
  }
 
  if(strcmp(cmdtext, "/pickweed", true)==0)
  {
    if (PlayerInfo[playerid][pPlantedWeed] > 0)
    {
     SendClientMessage(playerid, COLOR_GREY, "You have to wait till your plant grows.");
     SendClientMessage(playerid, COLOR_GREY, "You Still Have %d min.", PlayerInfo[playerid][pPlantedWeedTimes);
     return 1;
    }
    new Float:X, Float:Y, Float:Z, Float:A;
    GetPlayerObjectPos(playerid, Weed1, X, Y, Z)
    PlayerInfo[playerid][pDrugs] += 100;
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
    }
    PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
    SendClientMessage(playerid, 0x00800096,"You have Picked up your Weed plant and receved 100g of drugs.");
    SendClientMessage(playerid, 0x00800096,"You can now /usedrugs or /selldrugs /givedrugs...");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "* %s Picked up some weed.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    return 1;
  }




Re: Hy...I Need Some Help with GetPlayerObjectPos..... - Im_BanK - 02.03.2009

no one?

Pfff


Re: Hy...I Need Some Help with GetPlayerObjectPos..... - ICECOLDKILLAK8 - 02.03.2009

When they do /plantweed save the object co ords to a variable, Then in /pickweed use that variable