SA-MP Forums Archive
CMD Wont work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD Wont work (/showthread.php?tid=332525)



CMD Wont work - sanplayer - 08.04.2012

My Command doesnt work ingame and no compile errors :O
pawn Код:
CMD:aooc(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new sendername[MAX_PLAYER_NAME], string[56];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error.Correct usage: /ooc [text]");
        format(string, sizeof(string), "{00FF00}(( {FFFFFF}%s: %s {00FF00}))", sendername, params);
        SendClientMessageToAll(0xFFFFFFF, string);
    }
    else
    {
    SendClientMessage(playerid, 0xFF00FF, "[Admin] Sorry you are not a administrator!");
    }
    return 1;
}



Re: CMD Wont work - Boooth - 08.04.2012

You want this to work when your logged into the RCON?


Re: CMD Wont work - Cjgogo - 08.04.2012

pawn Код:
CMD:aooc(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new sendername[MAX_PLAYER_NAME], string[56];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[56]",string)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error.Correct usage: /ooc [text]");
        format(string, sizeof(string), "{00FF00}(( {FFFFFF}%s: %s {00FF00}))", sendername, params);
        SendClientMessageToAll(0xFFFFFFF, string);
    }
    else SendClientMessage(playerid, 0xFF00FF, "[Admin] Sorry you are not a administrator!");
  return 1;
}
Try it like that.


Re: CMD Wont work - sanplayer - 08.04.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
pawn Код:
CMD:aooc(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new sendername[MAX_PLAYER_NAME], string[56];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[56]",string)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error.Correct usage: /ooc [text]");
        format(string, sizeof(string), "{00FF00}(( {FFFFFF}%s: %s {00FF00}))", sendername, params);
        SendClientMessageToAll(0xFFFFFFF, string);
    }
    else SendClientMessage(playerid, 0xFF00FF, "[Admin] Sorry you are not a administrator!");
  return 1;
}
Try it like that.
I'll try, I am trying to make a freeroam script.

Any tutorials on making factions + a request cmd to requst to join a faction?

EDIT: It wont say my text

EDIT2: I'l try again, I didnt add sscanf plugin XDD

EDIT3: Didnt work, doesn't say my text


Re: CMD Wont work - [ABK]Antonio - 08.04.2012

change the string size to 128 (56 is really small, you're already using 47 by the time you get to the players text)


also...You don't need sscanf for this, you can use what you already had.


Re: CMD Wont work - sanplayer - 08.04.2012

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
change the string size to 128 (56 is really small, you're already using 47 by the time you get to the players text)


also...You don't need sscanf for this, you can use what you already had.
It won't work just syas Syntyax error all the time when /aooc test


Re: CMD Wont work - Cjgogo - 08.04.2012

pawn Код:
CMD:aooc(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new sendername[MAX_PLAYER_NAME], string[512],message[256];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[256]",message)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error.Correct usage: /ooc [text]");
        format(string, sizeof(string), "{00FF00}(( {FFFFFF}%s: %s {00FF00}))", sendername, message);
        SendClientMessageToAll(0xFFFFFFF, string);
    }
    else SendClientMessage(playerid, 0xFF00FF, "[Admin] Sorry you are not a administrator!");
  return 1;
}
Try it like that,you had no string defined for the message you were about to send


Re: CMD Wont work - [ABK]Antonio - 08.04.2012

pawn Код:
CMD:aooc(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFFF,"Syntax error.Correct usage: /ooc [text]");
        new sendername[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "{00FF00}(( {FFFFFF}%s: %s {00FF00}))", sendername, params);
        SendClientMessageToAll(0xFFFFFFAA, string);
    }
    else return SendClientMessage(playerid, 0xFF00FFAA, "[Admin] Sorry you are not a administrator!");
    return 1;
}
To above...He has a string already, it's called params...

/aooc THIS IS THE PARAMS


Re: CMD Wont work - Cjgogo - 08.04.2012

Just try my way first,and congratulatione Antonio for posting the same thing 5 players already did,and sanplayer claimed didn't work,keep the good job on


Re: CMD Wont work - sanplayer - 08.04.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
pawn Код:
CMD:aooc(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new sendername[MAX_PLAYER_NAME], string[512],message[256];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[256]",message)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error.Correct usage: /ooc [text]");
        format(string, sizeof(string), "{00FF00}(( {FFFFFF}%s: %s {00FF00}))", sendername, message);
        SendClientMessageToAll(0xFFFFFFF, string);
    }
    else SendClientMessage(playerid, 0xFF00FF, "[Admin] Sorry you are not a administrator!");
  return 1;
}
Try it like that,you had no string defined for the message you were about to send
nope,

Why can no-one fix this xD