Drug Scripting
#1

Ok So Im Trying My Hand At A Drug System For The Tenth Time As None Of The Other Tries Have Worked So I Want To Make Fully Sure It Does This time


For Starters I Use Enums correct like with playerinfo etc etc

Код:
enum pInfo
{
pJailed,
pDrugs,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
then implementing that into things such as onplayerpickuppickup

i would do

Код:
PlayerInfo[playerid][pDrugs] == 1
OR


Код:
PlayerInfo[playerid][pDrugs] == +1
its very confusing at the least so im trying to make it the best i can any help is appreciated
Reply
#2

come on now dun be scared to call me a dumbass
Reply
#3

If im right you try to give the Player a Drug who enters the pickup.

If you want to ADD a drug to the current drugs the player has, youll have to do it like that:
PlayerInfo[playerid][pDrugs] += 1;

Or if you want to TAKE 1 drug:
PlayerInfo[playerid][pDrugs] -= 1;
Reply
#4

Whoo Ok that solves one part of the mystery


Код:
This Goes under onplayerpickuppickup

  if(pickupid == DrugPack)
if(gTeam[playerid] == TEAM_DEALER)// drug dealer team
{
Playerinfo[playerid][pDrugs] += 5
SendClientMessage(playerid,COLOR_RED,"You Have Picked Up Five Grams Of Drugs");
}
else
{
SendClientMessage(playerid,COLOR_RED,"You Are Not A Dealer!!!);
}


}
Correct?
Reply
#5

Havent you missed some brackets?

Код:
if(pickupid == DrugPack)
{
	if(gTeam[playerid] == TEAM_DEALER) // drug dealer team
	{
		Playerinfo[playerid][pDrugs] += 5
		SendClientMessage(playerid,COLOR_RED,"You Have Picked Up Five Grams Of Drugs");
	}
}
else
{
	SendClientMessage(playerid,COLOR_RED,"You Are Not A Dealer!);
}
Reply
#6

lol dam i knew i forgot something( i use tabsize 0 so indentation dun matter)

thanks for the help Dok
Reply
#7

Ok Heres Where It Gets Tricky

i would just convert my /pay command for drugs but drugs use player info so i have no idea how to make /givedrugs or /selldrugs

maybe look at GF?
Reply
#8

Sorry For The Triple Post

Ok I Officially converted GF drug system into mine that includes stoned system /accept drugs, /selldrugs and /usedrugs


now everything works right except when i sell the drugs it says it goes to my paycheck and i dont get the money

now this may seem weird but the problem isnt with /selldrugs its with /accept drugs because when he accepts them then it should send the money over heres the code modded by me

Код:
	if(strcmp(cmd,"/accept",true)==0)
  {
    if(IsPlayerConnected(playerid))
	  {
			new x_job[256];
			x_job = strtok(cmdtext, idx);
			if(!strlen(x_job)) {
				SendClientMessage(playerid, COLOR_WHITE, "|__________________ Accept __________________|");
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: accept [name]");
				SendClientMessage(playerid, COLOR_GRAY, "Available names: Drugs,");
				SendClientMessage(playerid, COLOR_WHITE, "|____________________________________________|");
				return 1;
			}
 if(strcmp(x_job,"drugs",true) == 0)
			{
			  if(DrugOffer[playerid] < 999)
			  {
			    if(GetPlayerMoney(playerid) > DrugPrice[playerid])
				  {
				    if(PlayerInfo[playerid][pDrugs] < 7)
				    {
					    if(IsPlayerConnected(DrugOffer[playerid]))
					    {
					      GetPlayerName(DrugOffer[playerid], giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
								format(string, sizeof(string), "* You bought %d gram for $%d from Drug Dealer %s.",DrugGram[playerid],DrugPrice[playerid],giveplayer);
								SendClientMessage(playerid, COLOR_BLUELIGHT, string);
								format(string, sizeof(string), "* %s has bought your %d gram, the $%d was added to your PayCheck.",sendername,DrugGram[playerid],DrugPrice[playerid]);
								SendClientMessage(DrugOffer[playerid], COLOR_BLUELIGHT, string);
								
								GivePlayerMoney(playerid, -DrugPrice[playerid]);
								PlayerInfo[playerid][pDrugs] += DrugGram[playerid];
								PlayerInfo[DrugOffer[playerid]][pDrugs] -= DrugGram[playerid];
					      DrugOffer[playerid] = 999;
								DrugPrice[playerid] = 0;
								DrugGram[playerid] = 0;
								return 1;
							}
							return 1;
						}
						else
						{
						  SendClientMessage(playerid, COLOR_GRAY, "  You are fully loaded with Drugs, use them first !");
						  return 1;
						}
					}
					else
					{
					  SendClientMessage(playerid, COLOR_GRAY, "  You can't afford those Drugs !");
					  return 1;
					}
			  }
			  else
			  {
			    SendClientMessage(playerid, COLOR_GRAY, "  No-one offerd you any Drugs !");
			    return 1;
			  }
			 }
please any help will be freaking helpful obviously but i would announce to samp forums "I LOVE (HELPER'S NAME HERE)!!!!!

Reply
#9

well i got it what you need to is add another giveplayermoney fucntion because if u see below:
pawn Код:
GivePlayerMoney(playerid, -DrugPrice[playerid]);
it says that take of the amount of money from the buyer, but yet it cant give money to the seller because theres not funtion for it.
try puting this next to the it.
pawn Код:
GivePlayerMoney(giveplayer, +DrugPrice[playerid]);
i cant just say it'll work coz i havent tested it. but its worth a try :P

Reply
#10

C:\DOCUME~1\EVERYO~1\Desktop\SERVER\GAMEMO~1\ThugL ife.pwn(2054) : error 035: argument type mismatch (argument 1)
C:\DOCUME~1\EVERYO~1\Desktop\SERVER\GAMEMO~1\ThugL ife.pwn(2054) : warning 215: expression has no effect



i have no idea why its saying that its the line that you gave me

i put it right under the line you told me it says that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)