SA-MP Forums Archive
Help - 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)
+--- Thread: Help (/showthread.php?tid=357241)



Help - kaloqn54 - 06.07.2012

i haven't script for years and i forgot somethings

Код:
if (strcmp("/buy", cmdtext, true, 6) == 0)
	{
            if(IsPlayerInRangeOfPoint(playerid, 3.0, 2547.9336,-1293.8936,1044.1250))
            {
            SendClientMessage(playerid, 0xFF4500AA, "What do you want:Heroin 8000$, Weed 6000$, MoonShine, 3000$");
            }
		  	return 1;
    }
i want to know how to make them buyuble and to check if you have drugs example /usedrug Heroin you used 1 grams Heroin, MoonShine or Weed.You have 0 grams od Heroin Weed MoonShine


Re: Help - .FuneraL. - 06.07.2012

Create the variables for drugs... example:

pawn Код:
new Heroin[MAX_PLAYERS];
new Weed[MAX_PLAYERS];
new MoonShine[MAX_PLAYERS];

// To Check if have drugs, use in The Function:

Heroin[playerid]
Weed[playerid]
MoonShine[playerid]

// Example of use variable.

new string[100];
format(string, sizeof(string), "You Have: %d Heroins", Heroin[playerid]);
SendClientMessage(playerid, -1, string);



Re: Help - kaloqn54 - 06.07.2012

like this
Код:
if (strcmp("/buy Heroin", cmdtext, true, 10) == 0)
	{
            SendClientMessage(playerid, 0xFF4500AA, "You've buyed 1 gram Heroin");
		    GivePlayerMoney(playerid, -8000);
            return 1;
    }



Re: Help - kaloqn54 - 06.07.2012

Код:
if (strcmp("/usedrug Heroin", cmdtext, true, 14) == 0)
	{
            SendClientMessage(playerid, 0xFF4500AA, "You've used 1gram Heroin");
		    Heroin[playerid]
		    SetPlayerDrunkLevel(playerid, 60);
		    SetPlayerWeather(playerid, 21);
		  	return 1;
    }
D:\igri\GTA San Andreas\filterscripts\xc.pwn(145 -- 146) : warning 215: expression has no effect
D:\igri\GTA San Andreas\filterscripts\xc.pwn(146) : error 001: expected token: ";", but found "-identifier-"


Re: Help - .FuneraL. - 06.07.2012

pawn Код:
Heroin[playerid]--;
Change the variable and compile.

And Buy Heroin, Place
pawn Код:
Heroin[playerid]++;
Heroin[playerid] it's Just to see how many drugs he has.



Re: Help - kaloqn54 - 06.07.2012

thx


Re: Help - kaloqn54 - 06.07.2012

thx so much


Re: Help - kaloqn54 - 06.07.2012

oh i wanted to ask if you have no drug to text this

Код:
if (strcmp("/usedrug Heroin", cmdtext, true, 14) == 0)
	{
            SendClientMessage(playerid, 0xFF4500AA, "You've used 1 gram Heroin");
		    Heroin[playerid]--;
		    SetPlayerDrunkLevel(playerid, 60);
		    SetPlayerWeather(playerid, 21);
		    else
		    {
				 SendClientMessage(playerid, 0xFF4500AA, "You don't have grams of Heroin");
		    }
		  	return 1;
    }
D:\igri\GTA San Andreas\filterscripts\xc.pwn(162) : error 029: invalid expression, assumed zero


Re: Help - kaloqn54 - 06.07.2012

wiil you help