Help with help command.. -
Azzeto - 22.11.2011
PHP код:
dcmd_help(playerid,params[])
{
if(strcmp(params,"general",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--General Commands--");
SendClientMessage(playerid, COLOR_WHITE,":: GENERAL :: /pay /charity /time /buy /unrentcar /unRentveh /switchkey /id /drink /buyclothes /doro /wo /knock /doorshout /resetspawn");
SendClientMessage(playerid, COLOR_GREY,":: GENERAL :: /resetupgrades(50k) /buygun /lock /skill /licenses /showlicenses(/sl) /report /atalk /animlist /stopanim /fuel /use");
SendClientMessage(playerid, COLOR_GREY,":: GENERAL :: (/re)port /cancel /accept /eject /usedrugs /contract /fill /admins (/f)actionlist /gps /chatmode /fightstyle /(de)attachweapon");
SendClientMessage(playerid, COLOR_WHITE,":: GENERAL :: (/wi)ndows /coin /trunk (/inv)entory /knock /knockout /give /gateopen /sid /smoke /(sur)render /cophelp /selectspawn");
SendClientMessage(playerid, COLOR_GROVE,":: GENERAL :: /cellphonehelp /househelp /notehelp /vehiclehelp /renthelp /businesshelp /leaderhelp /fishhelp /cookhelp /irchelp /derbyhelp /Bankhelp");
return 1;
}
else if(strcmp(params,"chat",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Chat Commands--");
SendClientMessage(playerid, COLOR_WHITE,":: CHAT :: (/o)oc /me /(ad)vertise (/cw)hisper (/s)hout /(w)hisper (/b) /(l)ocal (/f)action /me /do /togfam /togpm /togphone");
return 1;
}
else if(strcmp(params,"car",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Car Commands--");
SendClientMessage(playerid, COLOR_WHITE,":: CAR :: /engine /lon /loff");
return 1;
}
else if(strcmp(params,"gun",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Gun Commands--");
SendClientMessage(playerid, COLOR_GRAD3,":: Weapon :: /dgun /pgun /buygun (in ammunation)");
return 1;
}
else if(strcmp(params,"faction",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Faction Help--");
if(PlayerInfo[playerid][pLeader] == 14 || PlayerInfo[playerid][pMember] == 14)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: Triads :: (/r)adio (/jap)aneese /security");
}
if(PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pMember] == 15)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: Ballas :: (/r)adio (/rus)sian /security");
}
if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 5)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: Mexicans :: (/r)adio (/spa)nish /security ");
}
if(PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pMember] == 6)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: La Famiglia Vagos :: /gateopen /tuningopen (/r)adio /italian /security");
}
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
SendClientMessage(playerid,COLOR_YELLOW2,":: HITMAN :: /portable /Hitmenopen");
}
if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
{
SendClientMessage(playerid,COLOR_YELLOW2,":: LESSON :: /startlesson /stoplesson /givelicense");
}
return 1;
}
else if(strcmp(params,"job",true) == 0)
{
if(PlayerInfo[playerid][pJob] == 1) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Detective:: /find"); }
else if(PlayerInfo[playerid][pJob] == 2) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Lawyer :: /free"); }
else if(PlayerInfo[playerid][pJob] == 3) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Whore :: /sex"); }
else if(PlayerInfo[playerid][pJob] == 4) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Drug Dealer :: /selldrugs /get drugs"); }
else if(PlayerInfo[playerid][pJob] == 5) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Drug Dealer :: /dropcar"); }
else if(PlayerInfo[playerid][pJob] == 6) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Waiter :: /showmenu /cookuniform"); }
else if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - News Reporter :: /paper /papers /live /news [text]"); }
else if(PlayerInfo[playerid][pJob] == 7) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Mechanic :: /repair /refill /duty /tow"); }
else if(PlayerInfo[playerid][pJob] == 8) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Bodyguard :: /guard"); }
else if(PlayerInfo[playerid][pJob] == 10) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Car Dealer :: /sellcar"); }
//else if(PlayerInfo[playerid][pJob] == 11) {
//SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Stuntman :: /startstunt /stopstunt"); }
else if(PlayerInfo[playerid][pJob] == 12) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Boxer :: /fight /boxstats"); }
else if(PlayerInfo[playerid][pJob] == 13 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Taxi Driver :: /fare "); }
else if(PlayerInfo[playerid][pJob] == 14) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Bus Driver:: /fare"); }
else if(PlayerInfo[playerid][pJob] == 15) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Paper Boy :: /papers /bring /deliver"); }
else if(PlayerInfo[playerid][pJob] == 16) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Trucker :: /buyprods /sellprods /load"); }
else if(PlayerInfo[playerid][pJob] == 17) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Pizza Boy :: /duty /sellpizza"); }
else if(PlayerInfo[playerid][pJob] == 18) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Farmer :: /startharvest /stopharvest"); }
else if(PlayerInfo[playerid][pJob] == 19) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Illegal Farmer :: /startdrugharvest /stopdrugharvest"); }
else if(PlayerInfo[playerid][pJob] == 20) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Drugs Smuggler :: /smuggledrugs /selldrugsto"); }
else if(PlayerInfo[playerid][pJob] == 21) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Street Sweeper :: /startsweep /stopsweep"); }
else if(PlayerInfo[playerid][pJob] == 22) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Materials Smuggler :: /smugglemats /sellmats"); }
else if(PlayerInfo[playerid][pJob] == 23) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Arms Dealer:: /creategun /buymats"); }
return 1;
}
else
{
SendClientMessage(playerid,0xFF8000FF,"/help [section]");
SendClientMessage(playerid,0xFF8000FF,"(Sections: General - Chat - Car - Gun - Faction - Job)");
return 1;
}
}
Re: Help with help command.. -
grand.Theft.Otto - 22.11.2011
You posted the command.
What's the problem ?
Re: Help with help command.. -
Azzeto - 22.11.2011
Ingame it only shows the General Commands, when its supposed to show
PHP код:
/help [section]
(Sections: *all the sections here*)
if they just type /help
Re: Help with help command.. -
Germanator - 22.11.2011
Before the first strcmp, check if the params are null or not. You can achieve that with either isnull() [If you have that function] or with if(strlen(params) == 0).
Like this:
pawn Код:
dcmd_help(playerid,params[])
{
if(strlen(params) == 0) //if(isnull(params))
{
SendClientMessage(playerid,0xFF8000FF,"/help [section]");
SendClientMessage(playerid,0xFF8000FF,"(Sections: General - Chat - Car - Gun - Faction - Job)");
return 1;
}
else if(strcmp(params,"general",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--General Commands--");
.....
Re: Help with help command.. -
MP2 - 22.11.2011
At the top put
pawn Код:
if(!strlen(params))
{
SendClientMessage(playerid, 0xFF8000FF, "/help [section]");
return SendClientMessage(playerid, 0xFF8000FF, "(Sections: General - Chat - Car - Gun - Faction - Job)");
}
Re: Help with help command.. -
grand.Theft.Otto - 22.11.2011
Just like they said above ^
Put it all together:
pawn Код:
dcmd_help(playerid,params[])
{
if(strlen(params) == 0) //if(isnull(params))
{
SendClientMessage(playerid,-1,"/help [section]");
SendClientMessage(playerid,-1,"(Sections: General - Chat - Car - Gun - Faction - Job)");
}
else if(strcmp(params,"general",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--General Commands--");
SendClientMessage(playerid, COLOR_WHITE,":: GENERAL :: /pay /charity /time /buy /unrentcar /unRentveh /switchkey /id /drink /buyclothes /doro /wo /knock /doorshout /resetspawn");
SendClientMessage(playerid, COLOR_GREY,":: GENERAL :: /resetupgrades(50k) /buygun /lock /skill /licenses /showlicenses(/sl) /report /atalk /animlist /stopanim /fuel /use");
SendClientMessage(playerid, COLOR_GREY,":: GENERAL :: (/re)port /cancel /accept /eject /usedrugs /contract /fill /admins (/f)actionlist /gps /chatmode /fightstyle /(de)attachweapon");
SendClientMessage(playerid, COLOR_WHITE,":: GENERAL :: (/wi)ndows /coin /trunk (/inv)entory /knock /knockout /give /gateopen /sid /smoke /(sur)render /cophelp /selectspawn");
SendClientMessage(playerid, COLOR_GROVE,":: GENERAL :: /cellphonehelp /househelp /notehelp /vehiclehelp /renthelp /businesshelp /leaderhelp /fishhelp /cookhelp /irchelp /derbyhelp /Bankhelp");
}
else if(strcmp(params,"chat",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Chat Commands--");
SendClientMessage(playerid, COLOR_WHITE,":: CHAT :: (/o)oc /me /(ad)vertise (/cw)hisper (/s)hout /(w)hisper (/b) /(l)ocal (/f)action /me /do /togfam /togpm /togphone");
}
else if(strcmp(params,"car",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Car Commands--");
SendClientMessage(playerid, COLOR_WHITE,":: CAR :: /engine /lon /loff");
}
else if(strcmp(params,"gun",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Gun Commands--");
SendClientMessage(playerid, COLOR_GRAD3,":: Weapon :: /dgun /pgun /buygun (in ammunation)");
}
else if(strcmp(params,"faction",true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"--Faction Help--");
if(PlayerInfo[playerid][pLeader] == 14 || PlayerInfo[playerid][pMember] == 14)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: Triads :: (/r)adio (/jap)aneese /security");
}
if(PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pMember] == 15)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: Ballas :: (/r)adio (/rus)sian /security");
}
if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 5)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: Mexicans :: (/r)adio (/spa)nish /security ");
}
if(PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pMember] == 6)
{
SendClientMessage(playerid, COLOR_YELLOW2, ":: La Famiglia Vagos :: /gateopen /tuningopen (/r)adio /italian /security");
}
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
SendClientMessage(playerid,COLOR_YELLOW2,":: HITMAN :: /portable /Hitmenopen");
}
if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
{
SendClientMessage(playerid,COLOR_YELLOW2,":: LESSON :: /startlesson /stoplesson /givelicense");
}
}
else if(strcmp(params,"job",true) == 0)
{
if(PlayerInfo[playerid][pJob] == 1)
{
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Detective:: /find"); }
else if(PlayerInfo[playerid][pJob] == 2) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Lawyer :: /free"); }
else if(PlayerInfo[playerid][pJob] == 3) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Whore :: /sex"); }
else if(PlayerInfo[playerid][pJob] == 4) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Drug Dealer :: /selldrugs /get drugs"); }
else if(PlayerInfo[playerid][pJob] == 5) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Drug Dealer :: /dropcar"); }
else if(PlayerInfo[playerid][pJob] == 6) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Waiter :: /showmenu /cookuniform"); }
else if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - News Reporter :: /paper /papers /live /news [text]"); }
else if(PlayerInfo[playerid][pJob] == 7) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Mechanic :: /repair /refill /duty /tow"); }
else if(PlayerInfo[playerid][pJob] == 8) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Bodyguard :: /guard"); }
else if(PlayerInfo[playerid][pJob] == 10) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Car Dealer :: /sellcar"); }
//else if(PlayerInfo[playerid][pJob] == 11) {
//SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Stuntman :: /startstunt /stopstunt"); }
else if(PlayerInfo[playerid][pJob] == 12) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Boxer :: /fight /boxstats"); }
else if(PlayerInfo[playerid][pJob] == 13 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Taxi Driver :: /fare "); }
else if(PlayerInfo[playerid][pJob] == 14) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Bus Driver:: /fare"); }
else if(PlayerInfo[playerid][pJob] == 15) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Paper Boy :: /papers /bring /deliver"); }
else if(PlayerInfo[playerid][pJob] == 16) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Trucker :: /buyprods /sellprods /load"); }
else if(PlayerInfo[playerid][pJob] == 17) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Pizza Boy :: /duty /sellpizza"); }
else if(PlayerInfo[playerid][pJob] == 18) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Farmer :: /startharvest /stopharvest"); }
else if(PlayerInfo[playerid][pJob] == 19) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Illegal Farmer :: /startdrugharvest /stopdrugharvest"); }
else if(PlayerInfo[playerid][pJob] == 20) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Drugs Smuggler :: /smuggledrugs /selldrugsto"); }
else if(PlayerInfo[playerid][pJob] == 21) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Street Sweeper :: /startsweep /stopsweep"); }
else if(PlayerInfo[playerid][pJob] == 22) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Materials Smuggler :: /smugglemats /sellmats"); }
else if(PlayerInfo[playerid][pJob] == 23) {
SendClientMessage(playerid,COLOR_YELLOW2,":: JOB - Arms Dealer:: /creategun /buymats"); }
}
else
{
SendClientMessage(playerid,0xFF8000FF,"/help [section]");
SendClientMessage(playerid,0xFF8000FF,"(Sections: General - Chat - Car - Gun - Faction - Job)");
}
}
return 1;
}
I also removed all the return 1; and added one at the bottom/end of the command. Too many returns can give you problems in-game.