[Help] little weed system. -
Galletziz - 20.04.2014
Hi boyz i have a little problem whit this filterscript that i have create:
Look second page..
Re: [Help] little weed system. -
xVIP3Rx - 20.04.2014
Maybe because you have less then 5 seeds ?
pawn Код:
if(pinfo[playerid][seeds] < 5) return 0;
Respuesta: [Help] little weed system. -
Xabi - 20.04.2014
Try to put a SendClientMessage on this line, instead of returning 0:
pawn Код:
if(pinfo[playerid][seeds] < 5) return 0;
Re: Respuesta: [Help] little weed system. -
Galletziz - 20.04.2014
Quote:
Originally Posted by Xabi
Try to put a SendClientMessage on this line, instead of returning 0:
pawn Код:
if(pinfo[playerid][seeds] < 5) return 0;
|
ok, but i have seen the directory weed and when i send the command, it create 999 file .ini in the directory, why??
Respuesta: Re: Respuesta: [Help] little weed system. -
Xabi - 20.04.2014
Quote:
Originally Posted by Galletziz
ok, but i have seen the directory weed and when i send the command, it create 999 file .ini in the directory, why??
|
I think that's because you make INI_Open in a loop from 0 to 1000, so if it can't open a file because it doesn't exist, it just creates a new one.
Re: [Help] little weed system. -
xVIP3Rx - 20.04.2014
You're using y_ini incorrectly, Delete all the files and use this one..
pawn Код:
CMD:plantseed(playerid,params[])
{
if(pianteperplayer[playerid] == MAX_WEED_PER_PLAYER) return SendClientMessage(playerid,-1,"[SERVER] You can plant only 3 plant");
if(pinfo[playerid][seeds] < 5) return 0;
new id = contopiante;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
winfo[id][finita] = 0;
winfo[id][poswx] = x;
winfo[id][poswy] = y;
winfo[id][poswz] = z;
winfo[id][virtualworld] = GetPlayerVirtualWorld(playerid);
marijuanaid[id] = CreateDynamicObject(3409,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz],0.0,0.0,0.0,GetPlayerVirtualWorld(playerid));
ApplyAnimation(playerid,LIBRARY,ANIMATION,4.1,0,1,1,0,5000,0);
pinfo[playerid][seeds]--;
winfo[id][piantata] = 1;
pianteperplayer[playerid]++;
new file[40];
format(file,sizeof(file),dirweed,id);
new INI:FIEL = INI_Open(file);
INI_WriteInt(FILE, "Finita",0);
INI_WriteFloat(FILE, "Posx",x);
INI_WriteFloat(FILE, "Posz",z);
INI_WriteFloat(FILE, "posy",y);
INI_WriteInt(FILE, "VW",GetPlayerVirtualWorld(playerid));
INI_Close(FILE);
winfo[id][labelweed] = Create3DTextLabel("On Harvest..",0xFF0000FF,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz],5.5,GetPlayerVirtualWorld(playerid));
contopiante++;
SetTimer("raccoltofinito",5000,false);
return 1;
}
Re: Respuesta: Re: Respuesta: [Help] little weed system. -
Galletziz - 20.04.2014
Quote:
Originally Posted by Xabi
I think that's because you make INI_Open in a loop from 0 to 1000, so if it can't open a file because it doesn't exist, it just creates a new one.
|
but in the CMD

lantseed it isn't in a loop.. only in stock function caricaweed() "loadweed()" i declare a loop becouse i want that when the player plant 3 seeds he can pick all seeds planted.
Re: [Help] little weed system. -
Galletziz - 20.04.2014
Quote:
Originally Posted by xVIP3Rx
You're using y_ini incorrectly, Delete all the files and use this one..
pawn Код:
CMD:plantseed(playerid,params[]) { if(pianteperplayer[playerid] == MAX_WEED_PER_PLAYER) return SendClientMessage(playerid,-1,"[SERVER] You can plant only 3 plant"); if(pinfo[playerid][seeds] < 5) return 0; new id = contopiante; new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); winfo[id][finita] = 0; winfo[id][poswx] = x; winfo[id][poswy] = y; winfo[id][poswz] = z; winfo[id][virtualworld] = GetPlayerVirtualWorld(playerid); marijuanaid[id] = CreateDynamicObject(3409,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz],0.0,0.0,0.0,GetPlayerVirtualWorld(playerid)); ApplyAnimation(playerid,LIBRARY,ANIMATION,4.1,0,1,1,0,5000,0); pinfo[playerid][seeds]--; winfo[id][piantata] = 1; pianteperplayer[playerid]++; new file[40]; format(file,sizeof(file),dirweed,id); new INI:FIEL = INI_Open(file); INI_WriteInt(FILE, "Finita",0); INI_WriteFloat(FILE, "Posx",x); INI_WriteFloat(FILE, "Posz",z); INI_WriteFloat(FILE, "posy",y); INI_WriteInt(FILE, "VW",GetPlayerVirtualWorld(playerid)); INI_Close(FILE); winfo[id][labelweed] = Create3DTextLabel("On Harvest..",0xFF0000FF,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz],5.5,GetPlayerVirtualWorld(playerid)); contopiante++; SetTimer("raccoltofinito",5000,false); return 1; }
|
i don't use YSI_Ini but SII.. look in includes.
Respuesta: Re: Respuesta: Re: Respuesta: [Help] little weed system. -
Xabi - 20.04.2014
Quote:
Originally Posted by Galletziz
but in the CMD  lantseed it isn't in a loop.. only in stock function caricaweed() "loadweed()" i declare a loop becouse i want that when the player plant 3 seeds he can pick all seeds planted.
|
When you call to caricapiante() at the start, the variable contopiante gets the value of 999, because of the contopiante++ you are doing. So after that, when you use the command to plant, id gets the value of this variable, 999.
Re: [Help] little weed system. -
Galletziz - 20.04.2014
I have changed all my code..
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include "registration_system.pwn"
#define MAX_WEED 1000
#define MAX_WEED_PER_PLAYER 3
#define LIBRARY "BOMBER"
#define ANIMATION "BOM_Plant_Crouch_In"
enum piantainfo
{
Float:poswx,
Float:poswy,
Float:poswz
}
new winfo[MAX_WEED][piantainfo];
new mariaobject[MAX_WEED];
new contopiante;
CMD:plantseed(playerid,params[])
{
if(pinfo[playerid][seeds] < 5) return SendClientMessage(playerid,-1,"[SERVER]You havn't sufficient seeds for plant");
new id = contopiante;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
winfo[id][poswx] = x;
winfo[id][poswy] = y;
winfo[id][poswz] = z;
mariaobject[id] = CreateObject(3409,x,y,z,0.0,0.0,0.0,100);
contopiante++;
return 1;
}
CMD:pickweed(playerid,params[])
{
for(new i = 0; i < MAX_WEED; i++)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,winfo[i][poswx],winfo[i][poswy],winfo[i][poswz]))
{
DestroyObject(mariaobject[i]);
}
else
{
return 0;
}
}
return 1;
}
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
But when i plant more of one, when i try to pickweed only works on one that i have planted, why