SA-MP Forums Archive
What's wrong with this? - 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: What's wrong with this? (/showthread.php?tid=299523)



What's wrong with this? - Vic1990 - 26.11.2011

Код:
CMD:kick(playerid, params[])
{
    new
        string[128],
        giveplayerid,
        adminname[MAX_PLAYER_NAME],
        playername[MAX_PLAYER_NAME],
        reason[50];
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COL_GREY, "You are not authorized for that command!");
    else if(sscanf(params, "rs[50]", giveplayerid, reason)) return SendClientMessage(playerid, COL_GREY, "[SYNTAX]: /kick [ID/PartOfName] [10.chars.max] [50.chars.max]");
    else if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_GREY, "Invalid playerid!");
    else {
        format(string, sizeof(string), "SERVER: %s have been kicked by %s, reason: %s.", playername, adminname, reason);
        SendClientMessageToAll(COL_RED, string);
        Kick(giveplayerid);
    }
    return 1;
}
With that code I get this error?
Код:
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(744) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 744 is
Код:
        SendClientMessageToAll(COL_RED, string);



Re: What's wrong with this? - Calgon - 26.11.2011

Where (and how) do you define the 'COL_RED' define?


Re: What's wrong with this? - Vic1990 - 26.11.2011

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Where (and how) do you define the 'COL_RED' define?
It is defined under the includes (up the top of the script) and defined like this.
Код:
#define COL_RED "{F81414}"



Re: What's wrong with this? - Rob_Maate - 26.11.2011

Ahh
You've defined it as a string.

Try #define COL_RED 0xF81414FF


Re: What's wrong with this? - Calgon - 26.11.2011

Your colour must be in a hex format, the way you've defined the colour can only be used for colour embedding.

Either use this:
pawn Код:
SendClientMessageToAll(0xF81414FF, string);
Or this:
pawn Код:
SendClientMessageToAll(0, "COL_RED"string);



Re: What's wrong with this? - Vic1990 - 26.11.2011

Ohk thankyou!