Will this work
#1

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

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?
Reply
#3

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;
	}
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)