[Help] little weed system.
#1

Hi boyz i have a little problem whit this filterscript that i have create:

Look second page..
Reply
#2

Maybe because you have less then 5 seeds ?
pawn Код:
if(pinfo[playerid][seeds] < 5) return 0;
Reply
#3

Try to put a SendClientMessage on this line, instead of returning 0:

pawn Код:
if(pinfo[playerid][seeds] < 5) return 0;
Reply
#4

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??
Reply
#5

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.
Reply
#6

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;
}
Reply
#7

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 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.
Reply
#8

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.
Reply
#9

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
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.
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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)