[FilterScript] Simple Weed System
#1

Simply Weed System


Hello everyone, I decided to change the filterscript previously made ​​by me, by removing the various loops that were not needed and making the code a little more light. I hope you like it anyway, this filterscript includes the following commands:
Quote:
  • /druginventory: Shows the amount of seeds and weed you have.
  • /plantseed: Used for to plant your seeds.
  • /pickweed: Used for pick your weed.
  • /useweed: Used for smoke your weed.
  • /buyseeds: Used for buy the seeds. (This command does not work if you're not near a drug house.)
  • /giveweed: Used for give weed to other ID.
  • /giveseed: Used for give seed to other ID
pawn Code:
#include <zcmd>
#include <sscanf2>

#define MAX_WEED 1000
#define MAX_WEED_PER_PLAYER 3
#define LIBRARY "BOMBER"
#define ANIMATION "BOM_Plant_Crouch_In"

#define dmenuseeds 9009

enum playerinfo
{
        weed,
        seeds
}

new pinfo[MAX_PLAYERS][playerinfo]

enum weedinfo
{
    planted,
    finished,
    Float:poswx,
    Float:poswy,
    Float:poswz,
    Text3D:labelweed
}

new winfo[MAX_WEED][weedinfo];
new mariaobject[MAX_WEED];
new limit;
new plantcount;

forward harvesttimer();
public harvesttimer()
{
    for(new i = 0; i < MAX_WEED; i++)
    {
        winfo[i][finished] = 1;
        UpdateDynamic3DTextLabelText(winfo[i][labelweed],0xFF0000FF,"Harvest");
    }
    return 1;

}

forward stonedtimer(playerid);
public stonedtimer(playerid)
{
    SetPlayerWeather(playerid,0);
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == dmenuseeds)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(GetPlayerMoney(playerid) < 6000) return SendClientMessage(playerid,-1,"[SERVER] You haven't required money");
                    GivePlayerMoney(playerid,-6000);
                    pinfo[playerid][seeds] = pinfo[playerid][seeds] + 30;
                    SendClientMessage(playerid,-1,"[SERVER] You have choise the first pack and have buy 30 seeds");
                    return 1;
                }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 6000) return SendClientMessage(playerid,-1,"[SERVER] You haven't required money");
                    GivePlayerMoney(playerid,-12000);
                    pinfo[playerid][seeds] = pinfo[playerid][seeds] + 60;
                    SendClientMessage(playerid,-1,"[SERVER] You have choise the second pack and have buy 60 seeds");
                    return 1;
                }
            }
        }
    }
    return 0;
}

CMD:plantseed(playerid,params[])
{
    if(pinfo[playerid][seeds] < 5) return SendClientMessage(playerid,-1,"[SERVER] You haven't enought seeds");
    if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,-1,"[SERVER] You can't do it in a vehicle");
    if(limite == MAX_WEED_PER_PLAYER) return SendClientMessage(playerid,-1,"[SERVER] You can't plant more of 3 seeds");
    new id = plantcount;
    GetPlayerPos(playerid,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz]);
    mariaobject[id] = CreateDynamicObject(3409,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz]-1,0.0,0.0,0.0,-1,-1,-1,100.0,0.0);
    ApplyAnimation(playerid,LIBRARY,ANIMATION,4.1,false,false,false,false,3000,false);
    winfo[id][labelweed] = CreateDynamic3DTextLabel("On Harvest",0xFF0000FF,winfo[id][poswx],winfo[id][poswy],winfo[id][poswz],100.0);
    pinfo[playerid][seeds] = pinfo[playerid][seeds] - 5;
    plantcount++;
    limit++;
    SetTimer("raccoltotimer",30000,false);
    return 1;

}

CMD:pickweed(playerid,params[])
{
    for(new i = 0; i < MAX_WEED; i++)
    {
      if(!IsPlayerInRangeOfPoint(playerid,2.5,winfo[i][poswx],winfo[i][poswy],winfo[i][poswz]-1)) continue;
      if(winfo[i][finished] == 0) return SendClientMessage(playerid,-1,"[SERVER] Wait just a little time for pick your weed");
      if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,-1,"[SERVER] You can't do it in a vehicle");
      DestroyDynamicObject(mariaobject[i]);
      DestroyDynamic3DTextLabel(winfo[i][labelweed]);
      pinfo[playerid][weed] = pinfo[playerid][weed] + 5;
      limit--;
    }

    return 1;
}

CMD:giveweed(playerid,params[])
{
    new ID, ammount;
    if(sscanf(params,"ui",ID,ammount)) return SendClientMessage(playerid,-1,"[SERVER] Use /giveweed [id][ammount]");
    if(ammount> pinfo[playerid][weed]) return SendClientMessage(playerid,-1,"[SERVER] You haven't sufficient weed");
    if(ID == playerid) return SendClientMessage(playerid,-1,"[SERVER] You can't send the weed at yourself");
    pinfo[playerid][weed] = pinfo[playerid][weed] - ammount;
    pinfo[ID][weed] = pinfo[ID][weed] + ammount;
    SendClientMessage(playerid,-1,"[SERVER] You has gived your weed");
    return 1;
}

CMD:giveseeds(playerid,params[])
{
    new ID, ammount;
    if(sscanf(params,"ui",ID,ammount)) return SendClientMessage(playerid,-1,"[SERVER] Use /giveseeds [id][ammount]");
    if(ammount > pinfo[playerid][seeds]) return SendClientMessage(playerid,-1,"[SERVER] You haven't sufficient seeds");
    if(ID == playerid) return SendClientMessage(playerid,-1,"[SERVER] You can't send seeds at yourself");
    pinfo[playerid][seeds] = pinfo[playerid][seeds] - ammount;
    pinfo[ID][seeds] = pinfo[ID][seeds] + ammount;
    SendClientMessage(playerid,-1,"[SERVER] You has gived your seeds");
    return 1;
}

CMD:useweed(playerid,params[])
{
    if(pinfo[playerid][weed] < 1) return SendClientMessage(playerid,-1,"[SERVER] You haven't weed.");
    SetPlayerWeather(playerid,-68);
    SendClientMessage(playerid,-1,"[SERVER] You are todaly stoned!.");
    pinfo[playerid][weed]--;
    SetTimer("stonedtimer",60000,false);
    return 1;
}

CMD:buyseeds(playerid,params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,3.5,2352,-1168.7,25)) return SendClientMessage(playerid,-1,"[SERVER] You aren't near drug house");
    if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,-1,"[SERVER]You can't do it in a vehicle");
    ShowPlayerDialog(playerid,9009,DIALOG_STYLE_LIST,"Buy seeds","Pack 1: 30 seeds($6000)\nPack 2: 60 seeds($12000)","Buy!","Quit");
    return 1;
}

CMD:druginventory(playerid,params[])
{
    new string[100];
    format(string,sizeof(string),"••• Drug Inventory •••");
    SendClientMessage(playerid,-1,string);
    format(string,sizeof(string),"[Weed]:%i, [Seeds]:%i",pinfo[playerid][weed],pinfo[playerid][seeds]);
    SendClientMessage(playerid,-1,string);
    return 1;

}
it's all.
Enjoy
Reply
#2

Nice!
Reply
#3

Quote:
Originally Posted by iRaiDeN
View Post
Nice!
Thanks

I forgot to write that the plants can all be collected after a certain time, no time difference between one and the other.
Reply
#4

Why are you looping through all connected players, then sending client messages to them?
Reply
#5

Quote:
Originally Posted by Galletziz
View Post
for all lovers of ganja i hope that like you.
Were you high when you made this script?
Reply
#6

Updated.. XD
Reply
#7

I agree u were high
Reply
#8

Are you blazed m8?
Reply
#9

Cool :P
Reply
#10

yeah he was High .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)