SA-MP Forums Archive
Help please. - 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)
+--- Thread: Help please. (/showthread.php?tid=361816)



Help please. - bodey3333 - 22.07.2012

Hello. So,Can you tell me about the best text CMD type? How to make a dialaogue box? And how to attach a function with a text CMD? And what is the right format for "IF - Then" And how to end it? And how to make it coniditional? Tutorialed samples please.
PS: Pawn Codes perfered.
!Thank you!



Re: Help please. - Cjgogo - 22.07.2012

Best text command type:ZCMD/YCMD(they look alike,it's up to your choice,I use ZCMD).
To make a dialog box follow this code:


pawn Код:
#define DIALOG_BOX 1
The name is again up to your choice,you can even define it as BODEY_3333 1,but the number 1 represents the current dialog number you're coding,if you already had 2 more dialogues then it would be DIALOG_BOX 3,got it :P?Next we show the dialog,togheter with this,I'll show you a command also:

pawn Код:
COMMAND:showbox(playerid,params[])
{
   ShowPlayerDialog(playerid,DIALOG_BOX,DIALOG_STYLE_MSGBOX,"Sample","Did you understand so far?","Yes","No");//We show the dialog for the player
   return 1;
}
We must also end the dialog,this is done inside the OnDialogResponse function wich is already implemented in your script:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid==1)//We check the dialog's id wich represents DIALOG_BOX in this case
    {
       if(response==0)//They pressed the second button of the dialog wich is in most cases "No","Cancel","Abort"
       {
           SendClientMessage(playerid,COLOR_RED,"Action canceled!");
       }
       if(response==1)//They pressed the first button,wich is in most cases "Yes","OK",etc.(defined by you,ofc)
      {
           SendClientMessage(playerid,COLOR_GREEN,"I hope you understood dialogs!");
           SendClientMessage(playerid,COLOR_GREEN,"Good luck!");
      }
    }
    return 1;
}
Now you have seen 3 things put togheter,the best command system and its usage,the dialog box,and attaching a function to a command(in this case,showing the dialog),and now,the if statement.We will script a command that kills the player,but only if he is on foot AND NOT on a vehicle:

pawn Код:
COMMAND:kill(playerid,params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SetPlayerHealth(playerid,0);//Now,this statement checks if the player IS NOT on a vehicle,and if it's true,then it kill the player,but if not,then...
    else//He IS on a vehicle
    {
         SendClientMessage(playerid,COLOR_RED,"You are in a vehicle,and you cannot kill yourself!);
     }
  return 1;
}
That's pretty much everything,I hope you understood.


Re: Help please. - [MM]RoXoR[FS] - 22.07.2012

ANSWER TO ALL QUESTIONS


Re: Help please. - Cjgogo - 22.07.2012

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Lol,just lol ,I actually gave him the asnwers to his questions,but,you know,your answer is funny really


Re: Help please. - Glint - 22.07.2012

We are not your slaves don't order us around and you can check the tutorial section for tutorials also drop the caps it won't help you in any ways.


Re: Help please. - Cjgogo - 22.07.2012

Quote:
Originally Posted by Lexi'
Посмотреть сообщение
We are not your slaves don't order us around and you can check the tutorial section for tutorials also drop the caps it won't help you in any ways.
"ANSWER TO ALL QUESTIONS" reply did not belong to the creator of the topic,but to a player who gave him link to SAMP wikipedia .


Re: Help please. - bodey3333 - 22.07.2012

Thanks,And if i got questions. I will re-post a topic about it.