#1


Ok so i made a /buyweed then /smokeweed

But there is a problem, Even though you didint /buyweed you can still /smokeweed please help, I am not experinced

Код:
if (strcmp("/BuyWeed", cmdtext, true, 10) == 0)
  {
  SendClientMessage(playerid,0xFFFFFFFF,"You come past a drug dealer and buy some weed...");
  SendClientMessage(playerid,0xFFFFFFFF,"To Smoke this weed type /smokeweed");
  GivePlayerMoney(playerid,-10000);
  return 1;
	 
}

  if (strcmp("/smokeweed", cmdtext, true, 10) == 0)
 {
 SendClientMessage(playerid,0xFFFFFFFF,"You roll up your joint lighting it.....");
 SetPlayerHealth(playerid,100);
 SetPlayerWeather(playerid,22);
 return 1;
 }
Reply
#2

Make a variable.
Reply
#3

if you didint read good i said i am not experinced

So theese little shit tips dont help me
Reply
#4

pawn Код:
new hasweed[MAX_PLAYERS];
if(!strcmp(cmdtext,"/buyweed",true))
{
  SendClientMessage(playerid,0xFFFFFFFF,"You come past a drug dealer and buy some weed...");
  SendClientMessage(playerid,0xFFFFFFFF,"To Smoke this weed type /smokeweed");
  GivePlayerMoney(playerid,-10000);
  hasweed[playerid]++;
  return 1;
     
}

if(!strcmp(cmdtext,"/smokeweed",true))
{
  if(!hasweed[playerid]) return SendClientMessage(playerid,0xFFFFFFFF,"You don't have weed to smoke.");
  SendClientMessage(playerid,0xFFFFFFFF,"You roll up your joint lighting it.....");
  SetPlayerHealth(playerid,100);
  SetPlayerWeather(playerid,22);
  hasweed[playerid]--;
  return 1;
}
Reply
#5

Thx
Reply
#6

Quote:
Originally Posted by MenaceX^
pawn Код:
new hasweed[MAX_PLAYERS];
if(!strcmp(cmdtext,"/buyweed",true))
{
 SendClientMessage(playerid,0xFFFFFFFF,"You come past a drug dealer and buy some weed...");
 SendClientMessage(playerid,0xFFFFFFFF,"To Smoke this weed type /smokeweed");
 GivePlayerMoney(playerid,-10000);
 hasweed[playerid]++;
 return 1;
     
}

if(!strcmp(cmdtext,"/smokeweed",true))
{
  if(!hasweed[playerid]) return SendClientMessage(playerid,0xFFFFFFFF,"You don't have weed to smoke.");
  SendClientMessage(playerid,0xFFFFFFFF,"You roll up your joint lighting it.....");
  SetPlayerHealth(playerid,100);
  SetPlayerWeather(playerid,22);
  hasweed[playerid]--;
  return 1;
}
Wait it dosent work -.-

I can still /smokeweed even though i didint /buyweed
Reply
#7

try this. I think it might work:

pawn Код:
new hasweed[MAX_PLAYERS];
if(!strcmp(cmdtext,"/buyweed",true))
{
  SendClientMessage(playerid,0xFFFFFFFF,"You come past a drug dealer and buy some weed...");
  SendClientMessage(playerid,0xFFFFFFFF,"To Smoke this weed type /smokeweed");
  GivePlayerMoney(playerid,-10000);
  hasweed[playerid]++;
  return 1;

}

if(!strcmp(cmdtext,"/smokeweed",true))
{
  if(hasweed[playerid] <= 0) return SendClientMessage(playerid,0xFFFFFFFF,"You don't have weed to smoke."); //change "0" to whatever is the miniimum weed needed to smoke weed
  SendClientMessage(playerid,0xFFFFFFFF,"You roll up your joint lighting it.....");
  SetPlayerHealth(playerid,100);
  SetPlayerWeather(playerid,22);
  hasweed[playerid]--;
  return 1;
}
The minimum weed required to smoke weed has been set to zero. Change it to whetever amount of weed you want.
Reply
#8

Quote:
Originally Posted by [B2K
Hustler ]
try this. I think it might work:

pawn Код:
new hasweed[MAX_PLAYERS];
if(!strcmp(cmdtext,"/buyweed",true))
{
 SendClientMessage(playerid,0xFFFFFFFF,"You come past a drug dealer and buy some weed...");
 SendClientMessage(playerid,0xFFFFFFFF,"To Smoke this weed type /smokeweed");
 GivePlayerMoney(playerid,-10000);
 hasweed[playerid]++;
 return 1;

}

if(!strcmp(cmdtext,"/smokeweed",true))
{
  if(hasweed[playerid] <= 0) return SendClientMessage(playerid,0xFFFFFFFF,"You don't have weed to smoke."); //change "0" to whatever is the miniimum weed needed to smoke weed
  SendClientMessage(playerid,0xFFFFFFFF,"You roll up your joint lighting it.....");
  SetPlayerHealth(playerid,100);
  SetPlayerWeather(playerid,22);
  hasweed[playerid]--;
  return 1;
}
The minimum weed required to smoke weed has been set to zero. Change it to whetever amount of weed you want.
Cool thx man
Reply
#9

in OnPlayerConnect.

pawn Код:
hasweed[playerid]=false;
Reply
#10

Quote:
Originally Posted by MenaceX^
in OnPlayerConnect.

pawn Код:
hasweed[playerid]=false;
No its ok i want it to save
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)