SA-MP Forums Archive
Sends error message? - 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: Sends error message? (/showthread.php?tid=443036)



Sends error message? - Affan - 10.06.2013

When I do this command in-game it says my error message, not server : unknown error

pawn Code:
COMMAND:color_green(playerid, params[])
   {
       SetPlayerColor(playerid, 0x33AA33AA);
       SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green");
       return 1;
   }



Re: Sends error message? - Ciandlah - 10.06.2013

Code:
COMMAND:color_green(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		SetPlayerColor(playerid, 0x33AA33AA);
		SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green");
	}
	return 1;
}
Try this


Re: Sends error message? - DerickClark - 10.06.2013

The code is wrong.it's not going to work with _ in the command.

Code:
COMMAND:colorgreen(playerid, params[])
{
    SetPlayerColor(playerid, 0x33AA33AA);
    SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green");
    return 1;
}
Do /colorgreen (ingame)


Re: Sends error message? - Affan - 10.06.2013

Quote:
Originally Posted by DerickClark
View Post
The code is wrong.it's not going to work with _ in the command.

Code:
COMMAND:colorgreen(playerid, params[])
{
    SetPlayerColor(playerid, 0x33AA33AA);
    SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green");
    return 1;
}
Do /colorgreen (ingame)
Oh thats why. Thanks but is there any way to do like /color green other than Onplayercommandtext?


Re: Sends error message? - DerickClark - 10.06.2013

You can't.i think maybe you can.


Re: Sends error message? - [ABK]Antonio - 10.06.2013

Quote:
Originally Posted by Affan
View Post
Oh thats why. Thanks but is there any way to do like /color green other than Onplayercommandtext?
You can use

pawn Code:
CMD:color(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xCC0000AA, "Valid colors: green, red, blue");

    new tmp[10];
    if(!strcmp(params, "green", true))
    {
        SetPlayerColor(playerid, 0x33AA33AA);
        tmp="green";
    }
    else if(!strcmp(params, "red", true))
    {
        SetPlayerColor(playerid, 0xFF0000AA);
        tmp="red";
    }
    else if(!strcmp(params, "blue", true))
    {
        SetPlayerColor(playerid, 0x0000FFAA);
        tmp="blue";
    }
    //and so on
   
    new string[100];
    format(string, sizeof(string), "You set your color to %s", tmp);
    SendClientMessage(playerid, 0xCCCC00AA, string);
    return 1;
}



Re: Sends error message? - Affan - 10.06.2013

@[ABK]Antonio: Thank you very much. +repped