SA-MP Forums Archive
Need Help With Dialogs - 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: Need Help With Dialogs (/showthread.php?tid=274794)



Need Help With Dialogs - lyrics - 07.08.2011

Hi Guys i need help on my dialog
I create a Rule Dialog + OnDialogResponse
when i press accept it gives me 500000 + 5 score
Now I want when i type /rules again and click accept
I want to have a return message like "You Already Accept The Rules!" + That will not give 500000$ And 5 Score

Heres my code OnDialogResponse:

Код:
 if(dialogid == 2)
  {
     if(response == 1)
     {
	 SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
	 GivePlayerMoney(playerid, 50000);
         SendClientMessage(playerid, COLOR_GREEN, "You Accept The Rules You Recieve $500000 + 5 Score Points"); 
     }
     else
     {
        SendClientMessage(playerid, COLOR_RED, "You Ignore The Rules");
        SendClientMessage(playerid, COLOR_RED, "You Have Been Kicked!, Reason : Ignoring The Rules");
	Kick(playerid);
     }
     return 1;
  }
Please Help!


Re: Need Help With Dialogs - emokidx - 07.08.2011

your /rule command please


Re: Need Help With Dialogs - lyrics - 08.08.2011

Quote:
Originally Posted by emokidx111
Посмотреть сообщение
your /rule command please
Here is the code

pawn Код:
if(strcmp("/rules", cmdtext, true, 10) == 0)
 {
    ShowPlayerDialog(playerid,2, DIALOG_STYLE_MSGBOX, "Rules:", "1.)Do Not Hack/Cheat/Mods\n2.)Respect Admins And Players\n3.)Do Not Ask To Be Admin We Choosing Admins\n4.)Do Not Use Admin Account And Try To Use It\n5.)No Insulting, Flamming The Admins\n6.)Dont Kill Player To Much (Spawn Killing)\nIf you break those rules you may Punishment by Our Server Administrators", "Accept", "Ignore");
    return 1;
 }



Re: Need Help With Dialogs - Rafa - 08.08.2011

try to replace the dialog id with his realname not with his number...


Re: Need Help With Dialogs - Babul - 08.08.2011

Код:
if(dialogid == 2)
{
	if(response == 1)
	{
		if(GetPVarInt(playerid,"RulesAccepted")!=1)
		{
			SetPVarInt(playerid,"RulesAccepted",1);
			SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
			GivePlayerMoney(playerid, 50000);
			SendClientMessage(playerid, COLOR_GREEN, "You Accept The Rules You Recieve $500000 + 5 Score Points");
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "You Already Accepted The Rules. You DONT Recieve $500000 + 5 Score Points Again!");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_RED, "You Ignore The Rules");
		SendClientMessage(playerid, COLOR_RED, "You Have Been Kicked!, Reason : Ignoring The Rules");
		Kick(playerid);
	}
	return 1;
}
i dont know if you like PVars, but it doesnt need any variables declared. dont forget to save the data aswell...


Re: Need Help With Dialogs - lyrics - 08.08.2011

Quote:
Originally Posted by Babul
Посмотреть сообщение
Код:
if(dialogid == 2)
{
	if(response == 1)
	{
		if(GetPVarInt(playerid,"RulesAccepted")!=1)
		{
			SetPVarInt(playerid,"RulesAccepted",1);
			SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
			GivePlayerMoney(playerid, 50000);
			SendClientMessage(playerid, COLOR_GREEN, "You Accept The Rules You Recieve $500000 + 5 Score Points");
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "You Already Accepted The Rules. You DONT Recieve $500000 + 5 Score Points Again!");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_RED, "You Ignore The Rules");
		SendClientMessage(playerid, COLOR_RED, "You Have Been Kicked!, Reason : Ignoring The Rules");
		Kick(playerid);
	}
	return 1;
}
i dont know if you like PVars, but it doesnt need any variables declared. dont forget to save the data aswell...
Didn't Work


Re: Need Help With Dialogs - [MG]Dimi - 08.08.2011

Quote:
Originally Posted by Rafa
Посмотреть сообщение
try to replace the dialog id with his realname not with his number...


Create Account variable like AccInfo[playerid][Rules]. Then do
PHP код:
if(AccInfo[playerid][Rules] == 0)
{
//here give money and score
AccInfo[playerid][Rules] = 1;//Here we set that player has read the rules
return 0;
}
if(
AccInfo[playerid][Rules] == 1)
{
//what ever you want if they have already read rules
return 1;




Re: Need Help With Dialogs - lyrics - 08.08.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение


Create Account variable like AccInfo[playerid][Rules]. Then do
PHP код:
if(AccInfo[playerid][Rules] == 0)
{
//here give money and score
AccInfo[playerid][Rules] = 1;//Here we set that player has read the rules
return 0;
}
if(
AccInfo[playerid][Rules] == 1)
{
//what ever you want if they have already read rules
return 1;

Dimi?! You still remember me? its me Kakashi [MG]Mr.Kakashi


Re: Need Help With Dialogs - lyrics - 08.08.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение


Create Account variable like AccInfo[playerid][Rules]. Then do
PHP код:
if(AccInfo[playerid][Rules] == 0)
{
//here give money and score
AccInfo[playerid][Rules] = 1;//Here we set that player has read the rules
return 0;
}
if(
AccInfo[playerid][Rules] == 1)
{
//what ever you want if they have already read rules
return 1;

Where Should I Put this and give me example


Re: Need Help With Dialogs - lyrics - 08.08.2011

Quote:
Originally Posted by Babul
Посмотреть сообщение
Код:
if(dialogid == 2)
{
	if(response == 1)
	{
		if(GetPVarInt(playerid,"RulesAccepted")!=1)
		{
			SetPVarInt(playerid,"RulesAccepted",1);
			SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
			GivePlayerMoney(playerid, 50000);
			SendClientMessage(playerid, COLOR_GREEN, "You Accept The Rules You Recieve $500000 + 5 Score Points");
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "You Already Accepted The Rules. You DONT Recieve $500000 + 5 Score Points Again!");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_RED, "You Ignore The Rules");
		SendClientMessage(playerid, COLOR_RED, "You Have Been Kicked!, Reason : Ignoring The Rules");
		Kick(playerid);
	}
	return 1;
}
i dont know if you like PVars, but it doesnt need any variables declared. dont forget to save the data aswell...
Now it work theres problem i didnt add the

pawn Код:
SetPVarInt(playerid,"RulesAccepted",1);
Thanks To You