Option Commands not working
#1

Basically, I am working on a Roleplay game mode and the commands that are optioned, aka you need to write after the command for it to work, don't work.

Like, /b. You need to write your text in /b but when I do. /b Test. It gives me the syntax of how to use /b. /admins and /enter and commands like that work, but commands that require text after the command itself don't work. Like /kick [ID] don't work. I put /kick 0 test, it'll just give me the syntax of the kick cmd.

I need help fast, anyone who can help me will get repped, thanks guys.
Reply
#2

It isn't a optional cmd if the cmd is like "/b [text]". Show us the code, we can't help you without it.
Reply
#3

Well, I couldn't really find the word to fit what I mean. I do /b Test and it will just send me the text syntax. It does this will all commands that require text after it, so. /b, /o, /kick, /ban, etc etc. Its all the commands that need text or an ID after the command for it to work. Single commands like /admins, /stats, /help work. I don't know how I can do this. I think it could be strtok but I am not sure.

Just incase;

pawn Код:
CMD:b(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SCM(playerid, COLOR_GREY, "** You havent logged in yet !");
            return 1;
        }
        if(PlayerInfo[playerid][pMuted] == 1)
        {
            SCM(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
            return 1;
        }
        new result[128],y,m,d,h,mi,s;
        getdate(y,m,d); gettime(h,mi,s);
        if(sscanf(params, "s[128]", result)) return SCM(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
        if(PlayerInfo[playerid][pAdminDuty] == 1)
        {
            format(tstring, sizeof(tstring), "(( Admin Says: %s ))", result);
        }
        if(PlayerInfo[playerid][pMod] == 1 && ModDuty[playerid] == 1)
        {
            format(tstring, sizeof(tstring), "(( Moderator Says: %s ))", result);
        }
        if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
        {
            format(tstring, sizeof(tstring), "(( Stranger Says: %s ))", result);
        }
        if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
        {
            format(tstring, sizeof(tstring), "(( %s Says: %s ))", GPN(playerid), result);
        }
        ProxDetector(20.0, playerid, tstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        format(cstring, sizeof(cstring), "(%d/%d/%d)[%d:%d:%d] %s (Local OOC): %s",d,m,y,h,mi,s, GPN(playerid), result);
        ChatLog(cstring);
    }
    return 1;
}
Reply
#4

Pretty weird tho, it could be that you have to define tstring.
Add
PHP код:
new tstring[75
Reply
#5

Maybe You can Learn From here
Reply
#6

: error 021: symbol already defined: "tstring"
Reply
#7

Quote:
Originally Posted by Amunra
Посмотреть сообщение
Maybe You can Learn From here
I think this is the problem, but I have no idea on how to fix it. This is so confusing.
Reply
#8

Quote:
Originally Posted by Swarn
Посмотреть сообщение
: error 021: symbol already defined: "tstring"
Error Lines ?
Reply
#9

try to change your line at /b

pawn Код:
if(sscanf(params, "s[128]", result)) return SCM(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
replace with

pawn Код:
if(sscanf(params, "s", result)) return SCM(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
Reply
#10

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
try to change your line at /b

pawn Код:
if(sscanf(params, "s[128]", result)) return SCM(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
replace with

pawn Код:
if(sscanf(params, "s", result)) return SCM(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
Tried, don't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)