if(pinfo[playerid][seeds] < 5) return 0;
if(pinfo[playerid][seeds] < 5) return 0;
Try to put a SendClientMessage on this line, instead of returning 0:
pawn Код:
|
ok, but i have seen the directory weed and when i send the command, it create 999 file .ini in the directory, why??
|
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 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.
|
You're using y_ini incorrectly, Delete all the files and use this one..
pawn Код:
|
but in the CMDlantseed 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.
|
#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