PDA

View Full Version : errors with help menu


DemME
19/06/2017, 10:56 PM
Howdy, so recently I have tried to shortcut the /help menu instead of spamming chat with text to be in sections. but I got errors whilst trying to configure each section to specific group (aka factions)



CMD:help(playerid, params[])
{
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(GetPVarInt(playerid, "Mute") == 1) return SendClientMessage(playerid, COLOR_ERROR, "You are currently muted!");
if(isnull(params))
{
SendClientMessage(playerid, COLOR_GREEN, "Usage: /Help [Section]");
SendClientMessage(playerid, COLOR_SIGN, "Sections: General, Chats, Hotkeys, Faction, Bizz, House, Furniture, Vehicle, Job, Phone, Donator, Bank, Helper");
return true;
}

if(strcmp("General", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"General Commands: /stats, /inventory (/inv - or press 'N' for quick access), /options (for various player options).");
SendClientMessage(playerid, COLOR_SIGN,"/me, /ame, /do, /try, /low, /shout, /b, /whisper (/w), /pm, /id, /clearchat, /time, /accept, /wt, /setfreq, /helpers, /admins");
SendClientMessage(playerid, COLOR_SIGN,"/pay, /cellphone, /togphone, /describe, /appearance, /shake, /newspaper, /options, /achivements.");
}
else if(strcmp("Chats", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"Chat Commands: Global OOC /o, Local OOC /b, Whisper /w, Shout /s, Faction /f, Quiet /l [RADIO: /r /wt]");
SendClientMessage(playerid, COLOR_SIGN,"Toggle Chats: use '/options' for player options - > Toggle Chats.");
}
else if(strcmp("Hotkeys", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"'N' - Shows the inventory of your character, vehicle trunk or nearby safe.");
SendClientMessage(playerid, COLOR_SIGN,"'Y' - Alternate button. (startup engine, reload weapon and more)");
SendClientMessage(playerid, COLOR_SIGN,"'LMB' - Toggle vehicle lights.");
}
else if(strcmp("Faction", params, true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"Faction Commands: /factionon, /flist, /f(action), /uninvite, /invite, /rank");
SendClientMessage(playerid, COLOR_SIGN, "Non-Governmental Factions: /rights (mainly used for warehouse access and such)")

if(GetPVarInt(playerid, "Member") == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not in a faction!");
if(GetPVarInt(playerid, "Member") != FACTION_LSPD) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSPD!");
{
SendClientMessage(playerid, COLOR_SIGN, "LSPD: /earpiece, /tow, /detain, /m(egaphone), /taser (/ta), /tackle, /cblock, /rblock, /rblockall, /rblockedit, /showbadge, /carsign, /impound, /kevlar");
SendClientMessage(playerid, COLOR_SIGN, "LSPD: /el (custom siren), /elm (strob lights), /handcuff, /uncuff, /drag, /take, /suspect(/su), /address, /spike, /breathe, /obtainweed, /impound, /hq");
SendClientMessage(playerid, COLOR_SIGN, "LSPD: /bolo, /arrest, /policespawn, /boatspawn, /acuspawn, /dooropen, /doorclose, /gateopen, /gateclose, /uniform, /removetag,/ mdc, /wireplayer, /departments");
}
else if(GetPVarInt(playerid, "Member") != FACTION_LSFD) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSFD!");
{
SendClientMessage(playerid, COLOR_SIGN, "FIRE DEP: /duty, /fdduty(near firetruck, to take firefighter equipement), /fdlocate, /treatplayer, /revive, /tow, /detain, /m, /tackle, /cblock, /rblock, /rblockall, /rblock edit");
SendClientMessage(playerid, COLOR_SIGN, "FIRE DEP: /showbadge, /carsign, /el, /elm, /address, /fdspawn, /doorclose, /dooropen, /gateopen, /gateclose, /uniform, /stretcher, /stopstretcher, /mdc , /department, /ram");
}
else if(GetPVarInt(playerid, "Member") != FACTION_FOX_ENTERPRISE) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of SAN Network!");
{
SendClientMessage(playerid, COLOR_SIGN, "NEWS: /camera, /newsspawn, /live, /announce");
}
else if(GetPVarInt(playerid, "Member") != FACTION_LSG) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSG!");
{
SendClientMessage(playerid, COLOR_SIGN, "GOVERNMENT: /radio, /gov, /towcars, /factionrankbonus, /earpiece, /showbadge, /carsign, /el, /elm, /govspawn, /dooropen, /doorclose, /uniform, /locker, /mdc, /openbusiness, /closebusiness, /departments.");
}
}

else if(strcmp("Bizz", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN, "BUSINESS COMMANDS: /biz stats, /biz upgrade/ biz lock, /biz sell, /biz name, /biz radio, /biz solgan, /biz request (request products from truckers to your business).");
SendClientMessage(playerid, COLOR_SIGN, "BUSINESS COMMANDS: /biz cp, /biz sellto, /biz exit, /biz type, /biz plant (mapping your exterior/interior of your business), /biz edit, /biz removeall, /biz bareswitch");
SendClientMessage(playerid, COLOR_SIGN, "BUSINESS COMMANDS: /biz bank, /biz deposit, /biz withdraw, /biz rights, /biz backdoor, /biz autolow, /biz sprunk, /biz actor, /safe.");
SendClientMessage(playerid, COLOR_RED, "REMINDER: Do not abuse any business comands, or you will be punished by administrators, use /biz plant or /biz actor wisely!");
}

else if(strcmp("House", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN, "HOUSE COMMANDS: /house stats, /house upgrade, /houes lock (/lock), /house sell, /house unrent(rent), /house radio, /house rentto, /house rentfee /house interior");
SendClientMessage(playerid, COLOR_SIGN, "HOUSE COMMANDS: /house rentlist, /house sellto, /house exit, /houes breakin, /house plant (mapping your house exterior/interior), /house edit, /house removeall");
SendClientMessage(playerid, COLOR_SIGN, "HOUSE COMMANDS: /house bank, /house deposit, /house withdraw, /house rights, /house backdoor, /houes clothing, /evict, /safe, /doorbell, /knock");
}
else if(strcmp("Furniture", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"Furniture Commands: /house plant, /biz plant, /map (for administrators only!)");
}

else if(strcmp("Vehicle", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN, "VEHICLE: /v(ehicle) spawn, stats, despawn, repair, sell, sellto, find, lock, lights, corpse, breakin");
SendClientMessage(playerid, COLOR_SIGN, "VEHICLE: payinsurance, trunk, bomb (plants bomb only if you are an official gang/mafia member).");
SendClientMessage(playerid, COLOR_SIGN, "MISC VEH: /windows (/wi), /seatbelt (/sb), /helmet, /fill.");
}

else if(strcmp("Job", params, true) == 0)
{
SendClientMessage(playerid, COLOR_JOB,"Job Commands: /getjob, /jobinfo(HINT: You can do this at the job's pickup only!), /quitjob.");
}
else if(strcmp("Phone", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"Phone Commands: /call(/dial) /sms(/txt) /pickup(/p) /hangup(/h) /phoneoff(/poff) /phoneon(/pon) /phoneinfo(/pinfo)");
SendClientMessage(playerid, COLOR_SIGN,"Phone Commands: /recharge /callback /smsback(/txtback) /loudspeaker /phone /lp /phoneshow");
}
else if(strcmp("Bank", params, true) == 0) SendClientMessage(playerid,COLOR_YELLOW,"Banking & Money Commands: /bank /atm /deposit /withdraw /balance");
else if(GetPVarInt(playerid, "Helper") == 0)
{
if(GetPVarInt(playerid, "Helper") >= 1)
{
SendClientMessage(playerid, COLOR_SIGN, "/ht, /hduty, /ha, /setint, /setvw, /setskin, /setage, /unfreeze, /setsex, /check, /accepthelpme(ahm), /checkad, /approvead, /denyad, /hpm.");
SendClientMessage(playerid, COLOR_SIGN, "HINT: Use /hpm to send a prive message without showing your name, for an example for answering questions.")
}
else return SysMsg(playerid, "You need to be a helper to view this section.");
}
else if(GetPVarInt(playerid, "Admin") == 0)
{
if(GetPVarInt(playerid, "Admin") >= 1)
{
//TO BE ADDED
}
else return SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
}
return true;
}



Errors I get :


../gamemodes/cmds.pwn(146) : error 001: expected token: ";", but found "if"
../gamemodes/cmds.pwn(153) : error 029: invalid expression, assumed zero


Mostly they're these lines:



if(GetPVarInt(playerid, "Member") == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not in a faction!");
if(GetPVarInt(playerid, "Member") != FACTION_LSPD) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSPD!");
{

Where I strict the access to whom isn't in the faction or not in factions at all, what have I missed?

AfiqIqbal
19/06/2017, 11:27 PM
You forgot to put ";", try this.

SendClientMessage(playerid, COLOR_SIGN, "Non-Governmental Factions: /rights (mainly used for warehouse access and such)");

DemME
20/06/2017, 02:28 AM
You forgot to put ";", try this.

SendClientMessage(playerid, COLOR_SIGN, "Non-Governmental Factions: /rights (mainly used for warehouse access and such)");

That doesn't change, still the same errors. please help..

AfiqIqbal
20/06/2017, 03:04 AM
You sure about that? Because you forgot tu put ";" after the closing bracket on SendClientMessage.

Just put ";" :

SendClientMessage(playerid, COLOR_SIGN, "Non-Governmental Factions: /rights (mainly used for warehouse access and such)");

NewFreeroamStunt
20/06/2017, 04:13 AM
Try This!



CMD:help(playerid, params[])
{
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(GetPVarInt(playerid, "Mute") == 1) return SendClientMessage(playerid, COLOR_ERROR, "You are currently muted!");
if(isnull(params))
{
SendClientMessage(playerid, COLOR_GREEN, "Usage: /Help [Section]");
SendClientMessage(playerid, COLOR_SIGN, "Sections: General, Chats, Hotkeys, Faction, Bizz, House, Furniture, Vehicle, Job, Phone, Donator, Bank, Helper");
return true;
}

if(strcmp("General", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"General Commands: /stats, /inventory (/inv - or press 'N' for quick access), /options (for various player options).");
SendClientMessage(playerid, COLOR_SIGN,"/me, /ame, /do, /try, /low, /shout, /b, /whisper (/w), /pm, /id, /clearchat, /time, /accept, /wt, /setfreq, /helpers, /admins");
SendClientMessage(playerid, COLOR_SIGN,"/pay, /cellphone, /togphone, /describe, /appearance, /shake, /newspaper, /options, /achivements.");
}
else if(strcmp("Chats", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"Chat Commands: Global OOC /o, Local OOC /b, Whisper /w, Shout /s, Faction /f, Quiet /l [RADIO: /r /wt]");
SendClientMessage(playerid, COLOR_SIGN,"Toggle Chats: use '/options' for player options - > Toggle Chats.");
}
else if(strcmp("Hotkeys", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"'N' - Shows the inventory of your character, vehicle trunk or nearby safe.");
SendClientMessage(playerid, COLOR_SIGN,"'Y' - Alternate button. (startup engine, reload weapon and more)");
SendClientMessage(playerid, COLOR_SIGN,"'LMB' - Toggle vehicle lights.");
}
else if(strcmp("Faction", params, true) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"Faction Commands: /factionon, /flist, /f(action), /uninvite, /invite, /rank");
SendClientMessage(playerid, COLOR_SIGN, "Non-Governmental Factions: /rights (mainly used for warehouse access and such)");

if(GetPVarInt(playerid, "Member") == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not in a faction!");
if(GetPVarInt(playerid, "Member") != FACTION_LSPD) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSPD!");
{
SendClientMessage(playerid, COLOR_SIGN, "LSPD: /earpiece, /tow, /detain, /m(egaphone), /taser (/ta), /tackle, /cblock, /rblock, /rblockall, /rblockedit, /showbadge, /carsign, /impound, /kevlar");
SendClientMessage(playerid, COLOR_SIGN, "LSPD: /el (custom siren), /elm (strob lights), /handcuff, /uncuff, /drag, /take, /suspect(/su), /address, /spike, /breathe, /obtainweed, /impound, /hq");
SendClientMessage(playerid, COLOR_SIGN, "LSPD: /bolo, /arrest, /policespawn, /boatspawn, /acuspawn, /dooropen, /doorclose, /gateopen, /gateclose, /uniform, /removetag,/ mdc, /wireplayer, /departments");
}
else if(GetPVarInt(playerid, "Member") != FACTION_LSFD) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSFD!");
{
SendClientMessage(playerid, COLOR_SIGN, "FIRE DEP: /duty, /fdduty(near firetruck, to take firefighter equipement), /fdlocate, /treatplayer, /revive, /tow, /detain, /m, /tackle, /cblock, /rblock, /rblockall, /rblock edit");
SendClientMessage(playerid, COLOR_SIGN, "FIRE DEP: /showbadge, /carsign, /el, /elm, /address, /fdspawn, /doorclose, /dooropen, /gateopen, /gateclose, /uniform, /stretcher, /stopstretcher, /mdc , /department, /ram");
}
else if(GetPVarInt(playerid, "Member") != FACTION_FOX_ENTERPRISE) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of SAN Network!");
{
SendClientMessage(playerid, COLOR_SIGN, "NEWS: /camera, /newsspawn, /live, /announce");
}
else if(GetPVarInt(playerid, "Member") != FACTION_LSG) return SendClientMessage(playerid, COLOR_ERROR, "You are not a member of LSG!");
{
SendClientMessage(playerid, COLOR_SIGN, "GOVERNMENT: /radio, /gov, /towcars, /factionrankbonus, /earpiece, /showbadge, /carsign, /el, /elm, /govspawn, /dooropen, /doorclose, /uniform, /locker, /mdc, /openbusiness, /closebusiness, /departments.");
}
}

else if(strcmp("Bizz", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN, "BUSINESS COMMANDS: /biz stats, /biz upgrade/ biz lock, /biz sell, /biz name, /biz radio, /biz solgan, /biz request (request products from truckers to your business).");
SendClientMessage(playerid, COLOR_SIGN, "BUSINESS COMMANDS: /biz cp, /biz sellto, /biz exit, /biz type, /biz plant (mapping your exterior/interior of your business), /biz edit, /biz removeall, /biz bareswitch");
SendClientMessage(playerid, COLOR_SIGN, "BUSINESS COMMANDS: /biz bank, /biz deposit, /biz withdraw, /biz rights, /biz backdoor, /biz autolow, /biz sprunk, /biz actor, /safe.");
SendClientMessage(playerid, COLOR_RED, "REMINDER: Do not abuse any business comands, or you will be punished by administrators, use /biz plant or /biz actor wisely!");
}

else if(strcmp("House", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN, "HOUSE COMMANDS: /house stats, /house upgrade, /houes lock (/lock), /house sell, /house unrent(rent), /house radio, /house rentto, /house rentfee /house interior");
SendClientMessage(playerid, COLOR_SIGN, "HOUSE COMMANDS: /house rentlist, /house sellto, /house exit, /houes breakin, /house plant (mapping your house exterior/interior), /house edit, /house removeall");
SendClientMessage(playerid, COLOR_SIGN, "HOUSE COMMANDS: /house bank, /house deposit, /house withdraw, /house rights, /house backdoor, /houes clothing, /evict, /safe, /doorbell, /knock");
}
else if(strcmp("Furniture", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"Furniture Commands: /house plant, /biz plant, /map (for administrators only!)");
}

else if(strcmp("Vehicle", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN, "VEHICLE: /v(ehicle) spawn, stats, despawn, repair, sell, sellto, find, lock, lights, corpse, breakin");
SendClientMessage(playerid, COLOR_SIGN, "VEHICLE: payinsurance, trunk, bomb (plants bomb only if you are an official gang/mafia member).");
SendClientMessage(playerid, COLOR_SIGN, "MISC VEH: /windows (/wi), /seatbelt (/sb), /helmet, /fill.");
}

else if(strcmp("Job", params, true) == 0)
{
SendClientMessage(playerid, COLOR_JOB,"Job Commands: /getjob, /jobinfo(HINT: You can do this at the job's pickup only!), /quitjob.");
}
else if(strcmp("Phone", params, true) == 0)
{
SendClientMessage(playerid, COLOR_SIGN,"Phone Commands: /call(/dial) /sms(/txt) /pickup(/p) /hangup(/h) /phoneoff(/poff) /phoneon(/pon) /phoneinfo(/pinfo)");
SendClientMessage(playerid, COLOR_SIGN,"Phone Commands: /recharge /callback /smsback(/txtback) /loudspeaker /phone /lp /phoneshow");
}
else if(strcmp("Bank", params, true) == 0) SendClientMessage(playerid,COLOR_YELLOW,"Banking & Money Commands: /bank /atm /deposit /withdraw /balance");
else if(GetPVarInt(playerid, "Helper") == 0)
{
if(GetPVarInt(playerid, "Helper") >= 1)
{
SendClientMessage(playerid, COLOR_SIGN, "/ht, /hduty, /ha, /setint, /setvw, /setskin, /setage, /unfreeze, /setsex, /check, /accepthelpme(ahm), /checkad, /approvead, /denyad, /hpm.");
SendClientMessage(playerid, COLOR_SIGN, "HINT: Use /hpm to send a prive message without showing your name, for an example for answering questions.")
}
else return SysMsg(playerid, "You need to be a helper to view this section.");
}
else if(GetPVarInt(playerid, "Admin") == 0)
{
if(GetPVarInt(playerid, "Admin") >= 1)
{
//TO BE ADDED
}
else return SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
}
return true;
}

DemME
20/06/2017, 05:01 AM
You sure about that? Because you forgot tu put ";" after the closing bracket on SendClientMessage.

Just put ";" :

SendClientMessage(playerid, COLOR_SIGN, "Non-Governmental Factions: /rights (mainly used for warehouse access and such)");

Try This!


I have fixed it, I just removed return message when player is browsing the faction and it's compiled, gonna test it in-game though, thanks for the assistance eitherway