How can i make....
#1

Hello ,

I found a drug system script.
You can buy weed seed,pill seed and water.
You can plant the seed but you can only plant it on one point, and i want that players can plant it were the want.
Here is the script :

Код:
/*
*
	Drug System v1.0
	Credits: Sal_Kings, for the great idea
*
*/

#include <a_samp>

#define GREEN 			0x21DD00FF
#define RED 			0xE60000FF
#define ADMIN_RED 		0xFB0000FF
#define YELLOW 			0xFFFF00FF
#define ORANGE 			0xF97804FF
#define LIGHTRED 		0xFF8080FF
#define LIGHTBLUE 		0x00C2ECFF
#define PURPLE 			0xB360FDFF
#define BLUE 			0x1229FAFF
#define LIGHTGREEN 		0x38FF06FF
#define DARKPINK 		0xE100E1FF
#define NICESKY 		0x99FFFFAA
#define GRAY 			0xCECECEFF
#define WHITE 			0xFFFFFFAA

new Weed[MAX_PLAYERS];
new Pills[MAX_PLAYERS];
new Water[MAX_PLAYERS];
new pWeed[MAX_PLAYERS];
new PlantedWeed[MAX_PLAYERS];
new DonePills[MAX_PLAYERS];
new wBusy[MAX_PLAYERS];
new pBusy[MAX_PLAYERS];

new DrugTimer[MAX_PLAYERS];
new PillTimer[MAX_PLAYERS];

new Menu:DrugMenu;

new dPickup;

forward pDrug(playerid);
forward pPil(playerid);

public OnFilterScriptInit()
{
	print("\n-----------------------------------------");
	print(" Drug System v1.0 by [WsR]RyDeR - Loaded -");
	print("-----------------------------------------\n");
	
	dPickup = CreatePickup(1254, 1, 2459.5415,-1690.4342,13.5436);
	
	DrugMenu = CreateMenu("~g~~h~~h~DrugMenu", 1, 200.0, 100.0, 150.0, 150.0);
	AddMenuItem(DrugMenu, 0, "Weed Seed - ~r~$50");
	AddMenuItem(DrugMenu, 0, "Pills Ingredient - ~r~$100");
	AddMenuItem(DrugMenu, 0, "Pot of Water - ~r~$25");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public pDrug(playerid)
{
	pWeed[playerid] = 1;
	wBusy[playerid] = 0;
	KillTimer(DrugTimer[playerid]);
}

public pPil(playerid)
{
	pBusy[playerid] = 0;
	ClearAnimations(playerid);
	TogglePlayerControllable(playerid, true);
	KillTimer(PillTimer[playerid]);
	DonePills[playerid]+=5;
	SendClientMessage(playerid, GREEN, "<> You succesfully made 5 piece of Pills.");
}

public OnPlayerConnect(playerid)
{
	Weed[playerid] = 0;
	Pills[playerid] = 0;
	Water[playerid] = 0;
	PlantedWeed[playerid] = 0;
	DonePills[playerid] = 0;
	wBusy[playerid] = 0;
	pBusy[playerid] = 0;
	pWeed[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  Weed[playerid] = 0;
  Pills[playerid] = 0;
  Water[playerid] = 0;
  PlantedWeed[playerid] = 0;
  DonePills[playerid] = 0;
  wBusy[playerid] = 0;
  pBusy[playerid] = 0;
  pWeed[playerid] = 0;
  KillTimer(PillTimer[playerid]);
  KillTimer(DrugTimer[playerid]);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
  TogglePlayerControllable(playerid, true);
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == dPickup)
	{
		SendClientMessage(playerid, WHITE, "Ryder: Yo fool! What do you want?");
		ShowMenuForPlayer(Menu:DrugMenu, playerid);
		TogglePlayerControllable(playerid, false);
	}
}

public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:Menus;
  Menus = GetPlayerMenu(playerid);
  if(Menus == DrugMenu)
  {
    switch(row)
    {
      case 0: 
      {
        if(GetPlayerMoney(playerid) <= 50) return SendClientMessage(playerid, WHITE, "Ryder: You don't have money enough fool! I need $50.");
        GivePlayerMoney(playerid, -50);
				Weed[playerid]+=1;
  			TogglePlayerControllable(playerid, true);
				SendClientMessage(playerid, WHITE, "Ryder: You bought a Weed Seed.");
      }
      case 1:
      {
        if(GetPlayerMoney(playerid) <= 100) return SendClientMessage(playerid, WHITE, "Ryder: You don't have money enough fool! I need $100");
        GivePlayerMoney(playerid, -100);
				Pills[playerid]+=1;
				TogglePlayerControllable(playerid, true);
				SendClientMessage(playerid, WHITE, "Ryder: You bought a Pill Ingredient.");
      }
      case 2:
      {
        if(GetPlayerMoney(playerid) <= 25) return SendClientMessage(playerid, WHITE, "Ryder: You don't have money enough fool! I need $25");
				GivePlayerMoney(playerid, -25);
				Water[playerid]+=1;
				TogglePlayerControllable(playerid, true);
				SendClientMessage(playerid, WHITE, "Ryder: You bought a Pot of Water.");
      }
    }
  }
  return 1;
}

public OnPlayerExitedMenu(playerid)
{
  TogglePlayerControllable(playerid, true);
  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new string1[128];
	new string2[128];
	new string3[128];
	new string4[128];
	new string5[128];
	
	if(strcmp("/drughelp", cmdtext, true, 10) == 0)
	{
	  SendClientMessage(playerid, GREEN, "~~~~~~~~~~> Help <~~~~~~~~~~");
    SendClientMessage(playerid, WHITE, "- First you buy the Ingredients in Ryder's house.");
    SendClientMessage(playerid, WHITE, "- /mystuff to see what you got.");
    SendClientMessage(playerid, WHITE, "- /plantweed to plant weed.");
    SendClientMessage(playerid, WHITE, "- /useweed to use it.");
    SendClientMessage(playerid, WHITE, "- /makepills to make pills.");
    SendClientMessage(playerid, WHITE, "- /usepills to use it.");
    SendClientMessage(playerid, GREEN, "~~~~~~~~~~> Help <~~~~~~~~~~");
		return 1;
	}
	if(strcmp("/mystuff", cmdtext, true, 10) == 0)
	{
	  SendClientMessage(playerid, ADMIN_RED,"~~~~~~~~~~> My Stuff <~~~~~~~~~~");
	  if(Weed[playerid] >= 1)
	  {
	  	format(string1, 256, "- You have %d Weed Seed.", Weed[playerid]);
	  	SendClientMessage(playerid, WHITE, string1);
		}
		if(Pills[playerid] >= 1)
		{
	  	format(string2, 256, "- You have %d Pills Ingredient.", Pills[playerid]);
	  	SendClientMessage(playerid, WHITE, string2);
		}
		if(Water[playerid] >= 1)
		{
	  	format(string3, 256, "- You have %d Pots of Water.", Water[playerid]);
	  	SendClientMessage(playerid, WHITE, string3);
		}
		if(PlantedWeed[playerid] >= 1)
		{
	  	format(string4, 256, "- You have %d grams of Weed.", PlantedWeed[playerid]);
	  	SendClientMessage(playerid, NICESKY, string4);
		}
		if(DonePills[playerid] >= 1)
		{
	  	format(string5, 256, "- You have %d piece of pills.", DonePills[playerid]);
	  	SendClientMessage(playerid, NICESKY, string5);
		}
		SendClientMessage(playerid, ADMIN_RED,"~~~~~~~~~~> My Stuff <~~~~~~~~~~");
		return 1;
	}
	if(strcmp("/plantweed", cmdtext, true, 15) == 0)
	{
	  if(wBusy[playerid] == 1) return SendClientMessage(playerid, ADMIN_RED, "<!> You are already planting Weed");
	  if(Weed[playerid] >= 1 && Water[playerid] >= 1)
	  {
	    SetPlayerCheckpoint(playerid, 2461.7163,-1714.4058,13.5238, 5.0);
	    DrugTimer[playerid] = SetTimerEx("pDrug", 60000, 0, "i", playerid);
	    Weed[playerid] -=1;
	    Water[playerid] -=1;
	    SendClientMessage(playerid, GREEN, "<!> Check your Weed at the Backyard.");
		}
		else
		{
		  SendClientMessage(playerid, ADMIN_RED, "<!> You need at least a Weed Seed and a Pot of Water.");
		}
	  return 1;
	}
	if(strcmp("/useweed", cmdtext, true, 10) == 0)
	{
	  if(PlantedWeed[playerid] >= 1)
	  {
	    new Float:Health;
			GetPlayerHealth(playerid, Health);
			SetPlayerHealth(playerid, Health+20);
			PlantedWeed[playerid]-=1;
			wBusy[playerid] = 1;
	    SendClientMessage(playerid, GREEN, "<> You have used one gram of Weed.");
		}
		else
		{
		  SendClientMessage(playerid, ADMIN_RED, "<!> You need at least one gram of Weed to use it.");
		}
	  return 1;
	}
	if(strcmp("/makepills", cmdtext, true, 10) == 0)
	{
	  if(pBusy[playerid] == 1) return SendClientMessage(playerid, ADMIN_RED, "<!> You are already making Pills");
	  if(Pills[playerid] >= 1)
	  {
			TogglePlayerControllable(playerid, false);
			PillTimer[playerid] = SetTimerEx("pPil", 60000, 0, "i", playerid);
			Pills[playerid]-=1;
			SendClientMessage(playerid, GREEN, "<> You are making Pills...");
			pBusy[playerid] = 1;
			ApplyAnimation(playerid, "DEALER", "DEALER_DEAL", 4.0, 1, 1, 1, 1, 1);
		}
		else
		{
		  SendClientMessage(playerid, ADMIN_RED, "<!> You need Pill Ingredients to make Pills.");
		}
	  return 1;
	}
	if(strcmp("/usepills", cmdtext, true, 10) == 0)
	{
	  if(DonePills[playerid] >= 1)
	  {
   		new Float:Health;
			GetPlayerHealth(playerid, Health);
			SetPlayerHealth(playerid, Health+30);
			DonePills[playerid]-=1;
			SendClientMessage(playerid, GREEN, "<> You have used a Pil.");
		}
		else
		{
		  SendClientMessage(playerid, ADMIN_RED, "<!> You need some Pills to use it.");
		}
	  return 1;
	}
	return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
	if(pWeed[playerid] == 1)
	{
	  SendClientMessage(playerid, GREEN, "<> You harvested your weed. You can now do /useweed to use.");
	  PlantedWeed[playerid]+=3;
	  DisablePlayerCheckpoint(playerid);
	  pWeed[playerid] = 0;
	}
	else if(pWeed[playerid] == 0)
	{
	  SendClientMessage(playerid, ADMIN_RED, "<!> Your weed is not ready yet.");
	}
	return 1;
}
Can someone please help me,
Thanks already.
Reply


Messages In This Thread
How can i make.... - by Frank_Brown - 20.10.2009, 13:35
Re: How can i make.... - by mister_ic3 - 18.12.2009, 00:12

Forum Jump:


Users browsing this thread: 1 Guest(s)