SA-MP Forums Archive
Weed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Weed (/showthread.php?tid=78026)



Weed - Sal_Kings - 16.05.2009


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



Re: Weed - MenaceX^ - 16.05.2009

Make a variable.


Re: Weed - Sal_Kings - 16.05.2009

if you didint read good i said i am not experinced

So theese little shit tips dont help me


Re: Weed - MenaceX^ - 16.05.2009

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



Re: Weed - Sal_Kings - 16.05.2009

Thx


Re: Weed - Sal_Kings - 16.05.2009

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


Re: Weed - member - 16.05.2009

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.


Re: Weed - Sal_Kings - 16.05.2009

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


Re: Weed - MenaceX^ - 16.05.2009

in OnPlayerConnect.

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



Re: Weed - Sal_Kings - 16.05.2009

Quote:
Originally Posted by MenaceX^
in OnPlayerConnect.

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