errors with help menu
#1

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)

PHP Code:

CMD
:help(playeridparams[])
{
    if (
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"You must be logged in to use this.");
    if(
GetPVarInt(playerid"Mute") == 1) return SendClientMessage(playeridCOLOR_ERROR"You are currently muted!");
    if(
isnull(params))
    {
        
SendClientMessage(playeridCOLOR_GREEN"Usage: /Help [Section]");
        
SendClientMessage(playeridCOLOR_SIGN"Sections: General, Chats, Hotkeys, Faction, Bizz, House, Furniture, Vehicle, Job, Phone, Donator, Bank, Helper");
        return 
true;
    }
    
    if(
strcmp("General"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN,"General Commands: /stats, /inventory (/inv - or press 'N' for quick access), /options (for various player options).");
        
SendClientMessage(playeridCOLOR_SIGN,"/me, /ame, /do, /try, /low, /shout, /b, /whisper (/w), /pm, /id, /clearchat, /time, /accept, /wt, /setfreq, /helpers, /admins");
        
SendClientMessage(playeridCOLOR_SIGN,"/pay, /cellphone, /togphone, /describe, /appearance, /shake, /newspaper, /options, /achivements.");
    }
    else if(
strcmp("Chats"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN,"Chat Commands: Global OOC /o, Local OOC /b, Whisper /w, Shout /s, Faction /f, Quiet /l [RADIO: /r /wt]");
        
SendClientMessage(playeridCOLOR_SIGN,"Toggle Chats: use '/options' for player options - > Toggle Chats.");
    }
    else if(
strcmp("Hotkeys"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN,"'N' - Shows the inventory of your character, vehicle trunk or nearby safe.");
        
SendClientMessage(playeridCOLOR_SIGN,"'Y' - Alternate button. (startup engine, reload weapon and more)");
        
SendClientMessage(playeridCOLOR_SIGN,"'LMB' - Toggle vehicle lights.");
    }
    else if(
strcmp("Faction"paramstrue) == 0)
    {
        
SendClientMessage(playerid,COLOR_YELLOW,"Faction Commands: /factionon, /flist, /f(action), /uninvite, /invite, /rank");
        
SendClientMessage(playeridCOLOR_SIGN"Non-Governmental Factions: /rights (mainly used for warehouse access and such)")
        if(
GetPVarInt(playerid"Member") == 0) return SendClientMessage(playeridCOLOR_ERROR"You are not in a faction!");
        if(
GetPVarInt(playerid"Member") != FACTION_LSPD) return SendClientMessage(playeridCOLOR_ERROR"You are not a member of LSPD!");
        {
            
SendClientMessage(playeridCOLOR_SIGN"LSPD: /earpiece, /tow, /detain, /m(egaphone), /taser (/ta), /tackle, /cblock, /rblock, /rblockall, /rblockedit, /showbadge, /carsign, /impound, /kevlar");
            
SendClientMessage(playeridCOLOR_SIGN"LSPD: /el (custom siren), /elm (strob lights), /handcuff, /uncuff, /drag, /take, /suspect(/su), /address, /spike, /breathe, /obtainweed, /impound, /hq");
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_ERROR"You are not a member of LSFD!");
        {
            
SendClientMessage(playeridCOLOR_SIGN"FIRE DEP: /duty, /fdduty(near firetruck, to take firefighter equipement), /fdlocate, /treatplayer, /revive, /tow, /detain, /m, /tackle, /cblock, /rblock, /rblockall, /rblock edit");
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_ERROR"You are not a member of SAN Network!");
        {
            
SendClientMessage(playeridCOLOR_SIGN"NEWS: /camera, /newsspawn, /live, /announce");
        }
        else if(
GetPVarInt(playerid"Member") != FACTION_LSG) return SendClientMessage(playeridCOLOR_ERROR"You are not a member of LSG!");
        {
            
SendClientMessage(playeridCOLOR_SIGN"GOVERNMENT: /radio, /gov, /towcars, /factionrankbonus, /earpiece, /showbadge, /carsign, /el, /elm, /govspawn, /dooropen, /doorclose, /uniform, /locker, /mdc, /openbusiness, /closebusiness, /departments.");
        }
    }
    else if(
strcmp("Bizz"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_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(playeridCOLOR_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(playeridCOLOR_SIGN"BUSINESS COMMANDS: /biz bank, /biz deposit, /biz withdraw, /biz rights, /biz backdoor, /biz autolow, /biz sprunk, /biz actor, /safe.");
        
SendClientMessage(playeridCOLOR_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"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN"HOUSE COMMANDS: /house stats, /house upgrade, /houes lock (/lock), /house sell, /house unrent(rent), /house radio, /house rentto, /house rentfee /house interior");
        
SendClientMessage(playeridCOLOR_SIGN"HOUSE COMMANDS: /house rentlist, /house sellto, /house exit, /houes breakin, /house plant (mapping your house exterior/interior), /house edit, /house removeall");
        
SendClientMessage(playeridCOLOR_SIGN"HOUSE COMMANDS: /house bank, /house deposit, /house withdraw, /house rights, /house backdoor, /houes clothing, /evict, /safe, /doorbell, /knock");
    }
    else if(
strcmp("Furniture"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN,"Furniture Commands: /house plant, /biz plant, /map (for administrators only!)");
    }
    else if(
strcmp("Vehicle"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN"VEHICLE: /v(ehicle) spawn, stats, despawn, repair, sell, sellto, find, lock, lights, corpse, breakin");
        
SendClientMessage(playeridCOLOR_SIGN"VEHICLE: payinsurance, trunk, bomb (plants bomb only if you are an official gang/mafia member).");
        
SendClientMessage(playeridCOLOR_SIGN"MISC VEH: /windows (/wi), /seatbelt (/sb), /helmet, /fill.");
    }
    else if(
strcmp("Job"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_JOB,"Job Commands: /getjob, /jobinfo(HINT: You can do this at the job's pickup only!), /quitjob.");
    }
    else if(
strcmp("Phone"paramstrue) == 0)
    {
        
SendClientMessage(playeridCOLOR_SIGN,"Phone Commands: /call(/dial) /sms(/txt) /pickup(/p) /hangup(/h) /phoneoff(/poff) /phoneon(/pon) /phoneinfo(/pinfo)");
        
SendClientMessage(playeridCOLOR_SIGN,"Phone Commands: /recharge /callback /smsback(/txtback) /loudspeaker /phone /lp /phoneshow");
    }
    else if(
strcmp("Bank"paramstrue) == 0SendClientMessage(playerid,COLOR_YELLOW,"Banking & Money Commands: /bank /atm /deposit /withdraw /balance");
    else if(
GetPVarInt(playerid"Helper") == 0)
    {
        if(
GetPVarInt(playerid"Helper") >= 1)
        {
            
SendClientMessage(playeridCOLOR_SIGN"/ht, /hduty, /ha, /setint, /setvw, /setskin, /setage, /unfreeze, /setsex, /check, /accepthelpme(ahm), /checkad, /approvead, /denyad, /hpm.");
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_ERROR"You are not an administrator!");
    }
    return 
true;

Errors I get :

Quote:

../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:

PHP Code:

        
if(GetPVarInt(playerid"Member") == 0) return SendClientMessage(playeridCOLOR_ERROR"You are not in a faction!");
        if(
GetPVarInt(playerid"Member") != FACTION_LSPD) return SendClientMessage(playeridCOLOR_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?
Reply
#2

You forgot to put ";", try this.

PHP Code:
SendClientMessage(playeridCOLOR_SIGN"Non-Governmental Factions: /rights (mainly used for warehouse access and such)"); 
Reply
#3

Quote:
Originally Posted by AfiqIqbal
View Post
You forgot to put ";", try this.

PHP Code:
SendClientMessage(playeridCOLOR_SIGN"Non-Governmental Factions: /rights (mainly used for warehouse access and such)"); 
That doesn't change, still the same errors. please help..
Reply
#4

You sure about that? Because you forgot tu put ";" after the closing bracket on SendClientMessage.

Just put ";" :

PHP Code:
SendClientMessage(playeridCOLOR_SIGN"Non-Governmental Factions: /rights (mainly used for warehouse access and such)"); 
Reply
#5

Try This!

Code:
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;
}
Reply
#6

Quote:
Originally Posted by AfiqIqbal
View Post
You sure about that? Because you forgot tu put ";" after the closing bracket on SendClientMessage.

Just put ";" :

PHP Code:
SendClientMessage(playeridCOLOR_SIGN"Non-Governmental Factions: /rights (mainly used for warehouse access and such)"); 
Quote:
Originally Posted by NewFreeroamStunt
View Post
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)