#1

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
Reply
#2

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);
Reply
#3

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

Код:
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-"
Reply
#5

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.
Reply
#6

thx
Reply
#7

thx so much
Reply
#8

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
Reply
#9

wiil you help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)