[Pomoc]Rastojanje

Započeo [JV:RP] Milos
12. Jan. 2014. Zaključano
951
pregleda
13
postova
Milos_Jovanovic
5
Underboss
12. Jan. 2014.
Ime skripte: FC-RP
Opis problema: Pa ovako za sadnju droge kada kucam /drugs plant i onda pojavi se objekat biljke ali mogu da sadim jednu na drugu kako da uradim da se recimo rastojanje da bude u 3 4 metra,znaci samo mi treba rastojanje da ne moze da se sadi jenu na drugu
if(strcmp(cmd, "/drugsplant", true) == 0 || strcmp(cmd, "/saditravu", true) == 0)
{
if (!PlayerInfo) return SendClientMessage(playerid, COLOR_GREY,"Nemate semenke!");
{
for(new weed = 0; weed < sizeof(WeedInfo); weed++)
{
if(!PlayerToPoint(420.0,playerid, 2211.4373,-487.3233,114.0355)) return SendClientMessage(playerid,COLOR_GREY,"Niste u zoni gde mozete saditi marihuanu!");
{
if(WeedInfo == 0 && WeedInfo == 0)
{
if(PlayerInfo == 5 || PlayerInfo == 5 || PlayerInfo == 13 || PlayerInfo == 13)
{
    if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_WHITE, "Ne mozete saditi dok ste u vozilu!");
if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_WHITE, "Ne mozes ovde saditi marihuanu!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
    GetPlayerName(playerid, playername, 24);
ApplyAnimation(playerid, "BOMBER","BOM_Plant",4.0,0,0,0,0,0);
weedObject = CreateObject(19473, X, Y, Z-2, 0, 0, 0);
Weeder = 1200;
WeedInfo = X;
WeedInfo = Y;
WeedInfo = Z;
WeedInfo = 20;
WeedInfo = 1;
strmid(WeedInfo, playername, 0, strlen(playername), 50);
SendClientMessage(playerid,COLOR_FADE1,"Posadili ste marihuanu, sacekajte da naraste pa je uberite!");
//SendClientMessage(playerid,COLOR_FADE1,"Remember to type /pickweed Before someone else takes your weed!");
PlayerInfo -= 1;
WATER -= 1;
return 1;
}
  }
}
}
}
}
Rudimental
5
OG Legend
12. Jan. 2014.
Cekaj ti si to napravio da mozes bilo gde da sadis ili .. 😄 mada vidim u scripti da imas neku lokaciju za to mozda da uradis polja na kojima se moze saditi da ne gomila 100 puta na jednu te istu tacku ako si me razumeo
Milos_Jovanovic
5
Underboss
12. Jan. 2014.
Momak. trazim rastojanje ne trazim preporuke  😉
ermin.a
5
Underboss
12. Jan. 2014.
stock GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
{
    return floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) );
}


Mozda ti ovo pomogne, da izracunas razmak izmedju dvije tacke, pa provjeris jel razmak manji ili jednak da ne moze sadit.
Milos_Jovanovic
5
Underboss
13. Jan. 2014.
imam ove errore ovo sma stavio gde stoje stock-ovi
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(62690) : error 025: function heading differs from prototype
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(62691) : error 021: symbol already defined: "GetDistance"
Milos_Jovanovic
5
Underboss
14. Jan. 2014.
*BUMP*
Milos_Jovanovic
5
Underboss
16. Jan. 2014.
*BUMP*
ermin.a
5
Underboss
16. Jan. 2014.
,,Gdje stoje stockovi" XDDDDDD
stock GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
    return floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) );


Btw jesi siguran da nemas vec definisano 'GetDistance' u skripti, pokusaj promjenit naziv.
Milos_Jovanovic
5
Underboss
16. Jan. 2014.
evo napravio sam
#define GetDistance

evo erorra 🙂
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\pawno\include\morphinc.inc(3) : warning 219: local variable "x2" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\pawno\include\morphinc.inc(3) : warning 219: local variable "y2" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\pawno\include\morphinc.inc(3) : warning 219: local variable "z2" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(1229) : error 010: invalid function or declaration
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(3303) : warning 219: local variable "x2" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(3303) : warning 219: local variable "y2" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(3303) : warning 219: local variable "z2" shadows a variable at a preceding level
Vegas.
3
Hustler
16. Jan. 2014.
if(strcmp(cmd, "/drugsplant", true) == 0 || strcmp(cmd, "/saditravu", true) == 0)
{
if (!PlayerInfo) return SendClientMessage(playerid, COLOR_GREY,"Nemate semenke!");
{
for(new weed = 0; weed < sizeof(WeedInfo); weed++)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(!PlayerToPoint(420.0,playerid, 2211.4373,-487.3233,114.0355)) return SendClientMessage(playerid,COLOR_GREY,"Niste u zoni gde mozete saditi marihuanu!");
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, WeedInfo, WeedInfo, WeedInfo)) return SendClientMessage(playerid, COLOR_WHITE, "Odmaknite se od vec zasadjene bilje");
if(WeedInfo == 0 && WeedInfo == 0)
{
if(PlayerInfo == 5 || PlayerInfo == 5 || PlayerInfo == 13 || PlayerInfo == 13)
{
    if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_WHITE, "Ne mozete saditi dok ste u vozilu!");
if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_WHITE, "Ne mozes ovde saditi marihuanu!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
    GetPlayerName(playerid, playername, 24);
ApplyAnimation(playerid, "BOMBER","BOM_Plant",4.0,0,0,0,0,0);
weedObject = CreateObject(19473, X, Y, Z-2, 0, 0, 0);
Weeder = 1200;
WeedInfo = X;
WeedInfo = Y;
WeedInfo = Z;
WeedInfo = 20;
WeedInfo = 1;
strmid(WeedInfo, playername, 0, strlen(playername), 50);
SendClientMessage(playerid,COLOR_FADE1,"Posadili ste marihuanu, sacekajte da naraste pa je uberite!");
//SendClientMessage(playerid,COLOR_FADE1,"Remember to type /pickweed Before someone else takes your weed!");
PlayerInfo -= 1;
WATER -= 1;
return 1;
}
  }
}
}
}
}

Dodao sam ovo.
	if(IsPlayerInRangeOfPoint(playerid, 3.0, WeedInfo, WeedInfo, WeedInfo)) return SendClientMessage(playerid, COLOR_WHITE, "Odmaknite se od vec zasadjene bilje");
Ako ti ne odgovara radius koji sam postavio promjeni.
Milos_Jovanovic
5
Underboss
17. Jan. 2014.
Hvala radi ali imam ove warrning-e
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(48258) : warning 219: local variable "X" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(48258) : warning 219: local variable "Y" shadows a variable at a preceding level
C:\Users\x7\Desktop\NAJ NOVIJI FC\2013\Faction City\gamemodes\BOZIC.pwn(48258) : warning 219: local variable "Z" shadows a variable at a preceding level
ermin.a
5
Underboss
17. Jan. 2014.
mogao bi ovako da ti radi:
new Float:Xaaa,Float:Yaaa,Float:Zaaa;
GetPlayerPos(playerid, Xaaa,Yaaa, Zaaa);


ali bi ti mozda opet se negdje javio problem kad bi X,Y,Z koristio, pa preporucujem da pogledas gdje si radio, vjerovatno nisi iskoristio kreirane varijable negdje kako treba.
Vegas.
3
Hustler
17. Jan. 2014.
if(strcmp(cmd, "/drugsplant", true) == 0 || strcmp(cmd, "/saditravu", true) == 0)
{
if (!PlayerInfo) return SendClientMessage(playerid, COLOR_GREY,"Nemate semenke!");
{
for(new weed = 0; weed < sizeof(WeedInfo); weed++)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(!PlayerToPoint(420.0,playerid, 2211.4373,-487.3233,114.0355)) return SendClientMessage(playerid,COLOR_GREY,"Niste u zoni gde mozete saditi marihuanu!");
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, WeedInfo, WeedInfo, WeedInfo)) return SendClientMessage(playerid, COLOR_WHITE, "Odmaknite se od vec zasadjene bilje");
if(WeedInfo == 0 && WeedInfo == 0)
{
if(PlayerInfo == 5 || PlayerInfo == 5 || PlayerInfo == 13 || PlayerInfo == 13)
{
    if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_WHITE, "Ne mozete saditi dok ste u vozilu!");
if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_WHITE, "Ne mozes ovde saditi marihuanu!");
GetPlayerPos(playerid, X, Y, Z);
    GetPlayerName(playerid, playername, 24);
ApplyAnimation(playerid, "BOMBER","BOM_Plant",4.0,0,0,0,0,0);
weedObject = CreateObject(19473, X, Y, Z-2, 0, 0, 0);
Weeder = 1200;
WeedInfo = X;
WeedInfo = Y;
WeedInfo = Z;
WeedInfo = 20;
WeedInfo = 1;
strmid(WeedInfo, playername, 0, strlen(playername), 50);
SendClientMessage(playerid,COLOR_FADE1,"Posadili ste marihuanu, sacekajte da naraste pa je uberite!");
//SendClientMessage(playerid,COLOR_FADE1,"Remember to type /pickweed Before someone else takes your weed!");
PlayerInfo -= 1;
WATER -= 1;
return 1;
}
  }
}
}
}
}

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha