SA-MP Forums Archive
Will this work - 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: Will this work (/showthread.php?tid=81910)



Will this work - JoeDaDude - 14.06.2009

How to do this?
I have a code,

pawn Код:
new C4BUY[MAX_PLAYERS];
And how do i make it do this,
When someone goes to shop and types,
/buy c4,

It changes

pawn Код:
C4BUY[playerid] = 0;
To

pawn Код:
C4BUY[playerid] = 1;
Is it like

pawn Код:
if (C4BUY[playerid] = 0;

C4BUY[playerid] = 1;

Is it possibly like that? Please update me


Re: Will this work - Weirdosport - 14.06.2009

Well in a command you use IsPlayerInArea, or PlayerToPoint with the co-ordinate of the shop, and if this returns true you change their variable...

What part of this are you having trouble with? The thing as a whole or setting the variables?


Re: Will this work - CJ101 - 14.06.2009

first ,make that a boolean. (bool)

then heres the command

Код:
if (strcmp("/c4buy", cmdtext, true, 10) == 0)
	{
	if(C4BUY[playerid] == true) return SendClientMessage(playerid,0xFF0000AA,"You already have one!");
    C4BUY[playerid] = true;
    SendClientMessage(playerid,0xFF0000AA,"Bought.");
		return 1;
	}



Re: Will this work - JoeDaDude - 14.06.2009

Quote:
Originally Posted by cj101
first ,make that a boolean. (bool)

then heres the command

Код:
if (strcmp("/c4buy", cmdtext, true, 10) == 0)
	{
	if(C4BUY[playerid] == true) return SendClientMessage(playerid,0xFF0000AA,"You already have one!");
    C4BUY[playerid] = true;
    SendClientMessage(playerid,0xFF0000AA,"Bought.");
		return 1;
	}
Ok little edit, See if this will work

pawn Код:
if (strcmp("/c4buy", cmdtext, true))
    {
    if(C4BUY[playerid] == true) return SendClientMessage(playerid,0xFF0000AA,"You already have one!");
    else if(C4BUY[playerid] == false)
    SendClientMessage(playerid, 0xFF0000AA, "You have purchased C4");
    C4BUY[playerid] == true)
    return 1;
    }