[HELP]Dialogs
#1

Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerCheckpoint(playerid, -30.4957, -55.6401, 1003.5469, 3.0);
	return 1;
}
Creates a Checkpoint inside a 24/7 In Los Santos
Код:
public OnPlayerEnterCheckpoint(playerid)
{
	ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Shop","\nMP3 Player","Buy","Cancel");
	return 1;
}
The shop Dialog
Код:
if(dialogid == 7 && response)
	{
	   switch(listitem)
	   {
		   case 0:
		   {
		   GivePlayerMoney(playerid, -1000);
		   SendClientMessage(playerid, COLOR_YELLOW, "You bought an mp3 player");
		   }
	   }
	 }
Now heres the catch I want to make it like this that if a player does not have 1000 dollars it says so and a player cannot buy it.
And if a player already has it it would say
Код:
SendClientMessage(playerid, COLOR_YELLOW, "Already Have an MP3 Player");
Thanks in Advance
Reply
#2

create a variable and make it default as 0.If a player buys a mp3 change it to 1.And if he clicks on buy if the variable is 1 SendClientMesssage or make the variable 1.And then do whatever u want to
Reply
#3

I tried but I don't exactly know how to add it to the code.
i made
new mp3;

then under the buying part I don't know how to write the code there.
Im still an beginner scripter
Reply
#4

bump
Reply
#5

pawn Код:
SetPVarInt(playerid,"MP3", 1);
pawn Код:
if(GetPVarInt(playerid,"MP3") != 1) return SendClientMessage(playerid, COLOR_YELLOW, "Already Have an MP3 Player");
Reply
#6

try this:
(The Shop Dialog)
pawn Код:
if(dialogid == 7 && response)
{
    switch(listitem)
    {
    case 0:
        {
            if(GetPVarInt(playerid,"HaveMP3") == 1) return SendClientMessage(playerid, -1, "{FF0000}You already have a MP3 player");
            if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, -1, "{FF0000}You don't have $1000 to buy a mp3 player");
            GivePlayerMoney(playerid, -1000);
            SendClientMessage(playerid, COLOR_YELLOW, "You bought a MP3 player");
            SetPVarInt(playerid,"HaveMP3",1);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)