14.05.2014, 15:03
(
Last edited by CharlieSanchez; 14/05/2014 at 03:38 PM.
)
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;
}
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

