strcmp : unknown command
#1

I use strcmp commands in my gamemode and when i time for explample /lcmds, the server says that the command was unknown.
I put return 0; at the end of OnPlayerCommandText and return 1; after the cmd. Here is the code:
pawn Код:
if(strcmp(cmd, "/lcmds", true) == 0) {
       
        if(PlayerInfo[playerid][Level] > 0)
        {
                SendClientMessage(playerid,blue,"    ---= [ Most Useful Admin Commands ] ==---");
                SendClientMessage(playerid,lightblue,"GENERAL: getinfo, lmenu, announce, write, miniguns, richlist, lspec(off), move, lweaps, adminarea, countdown, duel, giveweapon");
                SendClientMessage(playerid,lightblue,"GENERAL: slap, burn, warn, kick, ban, explode, jail, freeze, mute, crash, ubound, god, godcar, ping");
                SendClientMessage(playerid,lightblue,"GENERAL: setping, lockserver, enable/disable, setlevel, setinterior, givecar, jetpack, force, spawn");
                SendClientMessage(playerid,lightblue,"VEHICLE: flip, fix, repair, lockcar, eject, ltc, car, lcar, lbike, lplane, lheli, lboat, lnos, cm");
                SendClientMessage(playerid,lightblue,"TELE: goto, gethere, get, teleplayer, ltele, vgoto, lgoto, moveplayer");
                SendClientMessage(playerid,lightblue,"SET: set(cash/health/armour/gravity/name/time/weather/skin/colour/wanted/templevel)");
                SendClientMessage(playerid,lightblue,"SETALL: setall(world/weather/wanted/time/score/cash)");
                SendClientMessage(playerid,lightblue,"ALL: giveallweapon, healall, armourall, freezeall, kickall, ejectall, killall, disarmall, slapall, spawnall");
        }
    return 1;
}
Reply
#2

But is there a mistake in the script?
Reply
#3

I recommend you ZCMD.The fastest and the easiest command processor +sscanf for the best commands :P
Reply
#4

Ok, Ok I understood but can someone tell what is the error in the code to try fixing it?
Reply
#5

pawn Код:
if(strcmp(cmd, "/lcmds", true) == 0) {
       
        if(PlayerInfo[playerid][Level] >= 0)
        {
                SendClientMessage(playerid,blue,"    ---= [ Most Useful Admin Commands ] ==---");
                SendClientMessage(playerid,lightblue,"GENERAL: getinfo, lmenu, announce, write, miniguns, richlist, lspec(off), move, lweaps, adminarea, countdown, duel, giveweapon");
                SendClientMessage(playerid,lightblue,"GENERAL: slap, burn, warn, kick, ban, explode, jail, freeze, mute, crash, ubound, god, godcar, ping");
                SendClientMessage(playerid,lightblue,"GENERAL: setping, lockserver, enable/disable, setlevel, setinterior, givecar, jetpack, force, spawn");
                SendClientMessage(playerid,lightblue,"VEHICLE: flip, fix, repair, lockcar, eject, ltc, car, lcar, lbike, lplane, lheli, lboat, lnos, cm");
                SendClientMessage(playerid,lightblue,"TELE: goto, gethere, get, teleplayer, ltele, vgoto, lgoto, moveplayer");
                SendClientMessage(playerid,lightblue,"SET: set(cash/health/armour/gravity/name/time/weather/skin/colour/wanted/templevel)");
                SendClientMessage(playerid,lightblue,"SETALL: setall(world/weather/wanted/time/score/cash)");
                SendClientMessage(playerid,lightblue,"ALL: giveallweapon, healall, armourall, freezeall, kickall, ejectall, killall, disarmall, slapall, spawnall");
        }
    return 1;
}
Reply
#6

I want to fix this code, not to change the cmds system. Guest123, what is the difference between your code and my code. You only copy/paste it or i don't see the difference?
Reply
#7

Let's try like this:
pawn Код:
CMD:lcmds(playerid, params[]) //or COMMAND:yourcommandhere(playerid, params[])
{
        if(PlayerInfo[playerid][Level] > 0)
        {
                SendClientMessage(playerid,blue,"    ---= [ Most Useful Admin Commands ] ==---");
                SendClientMessage(playerid,lightblue,"GENERAL: getinfo, lmenu, announce, write, miniguns, richlist, lspec(off), move, lweaps, adminarea, countdown, duel, giveweapon");
                SendClientMessage(playerid,lightblue,"GENERAL: slap, burn, warn, kick, ban, explode, jail, freeze, mute, crash, ubound, god, godcar, ping");
                SendClientMessage(playerid,lightblue,"GENERAL: setping, lockserver, enable/disable, setlevel, setinterior, givecar, jetpack, force, spawn");
                SendClientMessage(playerid,lightblue,"VEHICLE: flip, fix, repair, lockcar, eject, ltc, car, lcar, lbike, lplane, lheli, lboat, lnos, cm");
                SendClientMessage(playerid,lightblue,"TELE: goto, gethere, get, teleplayer, ltele, vgoto, lgoto, moveplayer");
                SendClientMessage(playerid,lightblue,"SET: set(cash/health/armour/gravity/name/time/weather/skin/colour/wanted/templevel)");
                SendClientMessage(playerid,lightblue,"SETALL: setall(world/weather/wanted/time/score/cash)");
                SendClientMessage(playerid,lightblue,"ALL: giveallweapon, healall, armourall, freezeall, kickall, ejectall, killall, disarmall, slapall, spawnall");
        }
        return 1;
}
This code is properly!Your command processor is out dated, as ****** said.
Reply
#8

Quote:
Originally Posted by martoivanov
Посмотреть сообщение
I want to fix this code, not to change the cmds system. Guest123, what is the difference between your code and my code. You only copy/paste it or i don't see the difference?
you see this ?
pawn Код:
if(strcmp(cmd, "/lcmds", true) == 0) {
       
        if(PlayerInfo[playerid][Level] >= 0)
        {
                SendClientMessage(playerid,blue,"    ---= [ Most Useful Admin Commands ] ==---");
                SendClientMessage(playerid,lightblue,"GENERAL: getinfo, lmenu, announce, write, miniguns, richlist, lspec(off), move, lweaps, adminarea, countdown, duel, giveweapon");
                SendClientMessage(playerid,lightblue,"GENERAL: slap, burn, warn, kick, ban, explode, jail, freeze, mute, crash, ubound, god, godcar, ping");
                SendClientMessage(playerid,lightblue,"GENERAL: setping, lockserver, enable/disable, setlevel, setinterior, givecar, jetpack, force, spawn");
                SendClientMessage(playerid,lightblue,"VEHICLE: flip, fix, repair, lockcar, eject, ltc, car, lcar, lbike, lplane, lheli, lboat, lnos, cm");
                SendClientMessage(playerid,lightblue,"TELE: goto, gethere, get, teleplayer, ltele, vgoto, lgoto, moveplayer");
                SendClientMessage(playerid,lightblue,"SET: set(cash/health/armour/gravity/name/time/weather/skin/colour/wanted/templevel)");
                SendClientMessage(playerid,lightblue,"SETALL: setall(world/weather/wanted/time/score/cash)");
                SendClientMessage(playerid,lightblue,"ALL: giveallweapon, healall, armourall, freezeall, kickall, ejectall, killall, disarmall, slapall, spawnall");
        }
    return 1;
}
pawn Код:
if(PlayerInfo[playerid][Level] > 0)  to if(PlayerInfo[playerid][Level] >= 0)
Reply
#9

Fitri the problem is not there. I understood you all from the first time. I had another idea in my mind but you didn't understand it. This topic is over...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)