SA-MP Forums Archive
[FilterScript] Simple Helmet System 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple Helmet System With Dialogs. (/showthread.php?tid=513095)



Simple Helmet System With Dialogs. - CharlieSanchez - 14.05.2014

Hello, this is my first release off code , well after a bit of time i decided that i should release bits and things so that they might help and inspire others , well this is actually my first release so i apreciate contructive comments please and thank you for reading.
Simple Helmet System With Dialogs :



Code:
// Helmet System with dialogs , by Charlie Sanchez.

// There is roleplay messages on the dialog response ,
// however you must have implemented Proxymity detector for roleplay chat messages,
// so just un-comment them and job done !


#include <a_samp>
#include <zcmd>

#define DIALOG_HELMETSELECT 1



CMD:helmet(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid) == 1)
	{
		ShowPlayerDialog(playerid,DIALOG_HELMETSELECT,DIALOG_STYLE_LIST,"Select the helmet you wish to use.", "Helmet 1 - Fire Stripes. \n Helmet 2 - Blue and white motocross style. \n Helmet 3 - Red. \n Helmet 4 - White. \n Helmet 5 - Purple / pink. \n Remove helmet.", "Select", "Close");
	}
	if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
	{
	    ShowPlayerDialog(playerid,DIALOG_HELMETSELECT,DIALOG_STYLE_LIST,"Select the helmet you wish to use.", "Helmet 1 - Fire Stripes. \n Helmet 2 - Blue and white motocross style. \n Helmet 3 - Red. \n Helmet 4 - White. \n Helmet 5 - Purple / pink. \n Remove helmet.", "Select", "Close");
	}
	return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch( dialogid )
    {
		case DIALOG_HELMETSELECT:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
						SetPlayerAttachedObject(playerid,3 , 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
						SendClientMessage(playerid, -1,"Helmet 1 - Fire Stripes.");
						//new sendername[MAX_PLAYER_NAME], string[200];
						//GetPlayerName(playerid, sendername, sizeof(sendername));
						//sendername[strfind(sendername,"_")] = ' ';
    					//format(string, sizeof(string), "*%s reaches for the helmet, and puts it on.", sendername);
						//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           			}
                    case 1:
                    {
                    	SetPlayerAttachedObject(playerid,3 , 18976, 2, 0.07, 0.017, 0, 88, 75, 0);
						SendClientMessage(playerid, -1,"Helmet 2 - Blue and white motocross style.");
                        //new sendername[MAX_PLAYER_NAME], string[200];
						//GetPlayerName(playerid, sendername, sizeof(sendername));
						//sendername[strfind(sendername,"_")] = ' ';
    					//format(string, sizeof(string), "*%s reaches for the helmet, and puts it on.", sendername);
						//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        			}
                    case 2:
                    {
         				SetPlayerAttachedObject(playerid,3 , 18977, 2, 0.07, 0.017, 0, 88, 75, 0);
					    SendClientMessage(playerid, -1,"Helmet 3 - Red.");
                        //new sendername[MAX_PLAYER_NAME], string[200];
						//GetPlayerName(playerid, sendername, sizeof(sendername));
						//sendername[strfind(sendername,"_")] = ' ';
    					//format(string, sizeof(string), "*%s reaches for the helmet, and puts it on.", sendername);
						//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
      				}
                    case 3:
                    {
                        SetPlayerAttachedObject(playerid,3 , 18978, 2, 0.07, 0.017, 0, 88, 75, 0);
						SendClientMessage(playerid, -1,"Helmet 4 - White.");
                    	//new sendername[MAX_PLAYER_NAME], string[200];
						//GetPlayerName(playerid, sendername, sizeof(sendername));
						//sendername[strfind(sendername,"_")] = ' ';
    					//format(string, sizeof(string), "*%s reaches for the helmet, and puts it on.", sendername);
						//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
                    case 4:
                    {
                        SetPlayerAttachedObject(playerid,3 , 18979, 2, 0.07, 0.017, 0, 88, 75, 0);
						SendClientMessage(playerid, -1,"Helmet 5 - Purple / pink.");
                        //new sendername[MAX_PLAYER_NAME], string[200];
						//GetPlayerName(playerid, sendername, sizeof(sendername));
						//sendername[strfind(sendername,"_")] = ' ';
    					//format(string, sizeof(string), "*%s reaches for the helmet, and puts it on.", sendername);
						//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
                    case 5:
                    {
                        if(IsPlayerAttachedObjectSlotUsed(playerid, 3)) RemovePlayerAttachedObject(playerid, 3);
						SendClientMessage(playerid, -1,"Helmet Removed.");
                        //new sendername[MAX_PLAYER_NAME], string[200];
						//GetPlayerName(playerid, sendername, sizeof(sendername));
						//sendername[strfind(sendername,"_")] = ' ';
    					//format(string, sizeof(string), "*%s reaches for the helmet, and takes it off.", sendername);
						//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
            }
        }
 	}
	return 1;
}
Script requires, zcmd include, and if you wish to use the roleplay action messages you must implement proximity detector however it works as it is without Rp messages.!

Download link ( mediafire ):
http://www.mediafire.com/download/mt...met_System.rar
Pastbin Links :
http://pastebin.com/aERr7VJT

Screen Shots:
http://s19.postimg.org/tti00gkk3/sa_mp_008.png
http://s19.postimg.org/phosxpo9f/sa_mp_009.png
http://s19.postimg.org/r1yq9um1f/sa_mp_010.png
http://s19.postimg.org/jux1dzb4j/sa_mp_011.png
http://s19.postimg.org/olwww03yr/sa_mp_012.png
http://s19.postimg.org/f2n82jggj/sa_mp_013.png
http://s19.postimg.org/oe4olr3mb/sa_mp_014.png


Re: Simple Helmet System With Dialogs. - JonyNguyen - 14.05.2014

Nice .


Re: Simple Helmet System With Dialogs. - Mckarlis - 15.05.2014

WOW nice job


Re: Simple Helmet System With Dialogs. - satafinix - 16.05.2014

Look's Nice!


Re: Simple Helmet System With Dialogs. - CharlieSanchez - 19.05.2014

Thank you hope you guys use it and enjoy it! Cheers


Re: Simple Helmet System With Dialogs. - Rocky1993 - 19.05.2014

Simple and Nice


Re : Simple Helmet System With Dialogs. - Ke_NiReM - 20.05.2014

Nice Job


Re: Simple Helmet System With Dialogs. - Devil123 - 20.05.2014

GoodJob


Re: Simple Helmet System With Dialogs. - CharlieSanchez - 22.05.2014

Thank you.


Re: Simple Helmet System With Dialogs. - Team_PRO - 22.05.2014

cool