Simple Helmet System With Dialogs. -
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.
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.!
Re: Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -
Re : Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -
Re: Simple Helmet System With Dialogs. -