19.07.2012, 18:33
I creating this because i see some new scripters don't know how to make this so i think will be more usefull for they...
I will learn how to create all type of dialog : msgbox, input, list
Dialog: a box what will apear for player when is created.... he will apear only in center of the screen
So first we must create the dialog
playerid - id of the player
dialogid - id of the dialog
dialgo_style - the style of dialog: all dialogs type: DIALOG_STYLE_LIST ( list dialogs), DIALOG_STYLE_INPUT ( wite dialog) , DIALOG_STYLE_MSBOX ( only mesage)
title[] - the title of the dialog, text[] the text of the dialog, button1[], button2[] - button 1 and 2 what can be pressed with mouse( for newbies)
example :
and this can be used anywhere you want for example when player connect
playerid - id of the player
dialogid - id of the dialog
response - the first button if use ! in front of response this mean the second button..
listitem - items from list this will be something like this
first item from the list
inputtext - a string for dialogs
1. DIALOG_STYLE_MSGBOX
now wherever you want to create the function for example
our dialog
2. DIALOG_STYLE_INPUT
our dialog
3.DIALOG_STYLE_LIST
functions used in this tutorial
Check it on Help section
https://sampwiki.blast.hk/wiki/Category:Scripting_Functions
Ths for reading my tutorial , i hope this will be usefull for begginers , Comment if i did a mistake , or if you understand something, Good luck to learning
I will learn how to create all type of dialog : msgbox, input, list
Dialog: a box what will apear for player when is created.... he will apear only in center of the screen
So first we must create the dialog
pawn Code:
ShowPlayerDialog(playerid,dialogid,dialog_style,title[],text[],button1[],button2[]);
dialogid - id of the dialog
dialgo_style - the style of dialog: all dialogs type: DIALOG_STYLE_LIST ( list dialogs), DIALOG_STYLE_INPUT ( wite dialog) , DIALOG_STYLE_MSBOX ( only mesage)
title[] - the title of the dialog, text[] the text of the dialog, button1[], button2[] - button 1 and 2 what can be pressed with mouse( for newbies)
example :
pawn Code:
ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX,"Test Box","Test box","Box","Test");
pawn Code:
public OnPlayerConnect(playerid)
{
ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX,"Test Box","Test box","Box","Test");
return 1;
}
pawn Code:
and the callback
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext)
dialogid - id of the dialog
response - the first button if use ! in front of response this mean the second button..
listitem - items from list this will be something like this
pawn Code:
if(listitem == 0)
inputtext - a string for dialogs
1. DIALOG_STYLE_MSGBOX
now wherever you want to create the function for example
our dialog
Code:
ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX,"Rules","Do not use hacks","Accept","Decline");
pawn Code:
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext)
{
if(dialogid == 10) //verify if our dialog id is = with dialog created and if exist
{
if(!response) return Kick(playerid) // if player press Decline the rules he will get kick
if(response) // press the Accept button
{
GivePlayerMoney(playerid,500); // he will get 500 $ for accepting the rules
SendClientMessage(playerid,-1,"You got + 500 $ for accepting the rules!"); // send him/her a message
}
}
}
our dialog
pawn Code:
ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Skin Dialog,"Write an existent skin!","Finish","Cancel");
pawn Code:
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext)
{
if(dialogid == 10)
{
if( ! response) return 1; // in this case if press Cancel button it don't make anything but if write a skin and press Finish him/her skin will be setted!
if(response)
{
SetPlayerSkin(playerid,inputtext[0]); // set the desired skin by player
SendClientMessage(playerid,-1,"Skin succesfull setted");
}
}
}
pawn Code:
ShowPlayerDialog(playerid,10,DIALOG_STYLE_LISTS,"Skin List","Skin CJ\nSkin Police","Select","Cancel");
pawn Code:
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext)
{
if(dialogid == 10)
{
if(listitem == 0) //first item from list
{
SetPlayerSkin(playerid,0); //set the skn
SendClientMessage(playerid,-1,"Skin cj succesufll setted!");
}
if(listitem == 1) //second item from list
{
SetPlayerSkin(playerid,280);
SendClientMessage(playerid,-1,"Skin Police succesful setted!");
}
}
}
Code:
Kick(playerid); GivePlayerMoney(playerid,cash); SetPlayerSkin(playerid,skin); SendClientMessage(playerid,color,message); ShowPlayerDialog(playerid,dialogid,dialog_style,title[],text[],button1[],button2[]);
https://sampwiki.blast.hk/wiki/Category:Scripting_Functions
Ths for reading my tutorial , i hope this will be usefull for begginers , Comment if i did a mistake , or if you understand something, Good luck to learning