02.01.2016, 05:39
Hello everyone. I am not a pro scripter and thus want a help from you all.I wante to make a hidebadge command. It means that the player can hide his original nametag colour(the colour on your names when you press TAB)...
I used sscanf.. But I can't use it properly so I am using isnull..
First I defined these things at the top of my gamemode.
//---Some functions---//
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
//----end of these functions---//
Then I used this command...(I use i-zcmd to make commands..)
CMD:hbadge(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /hbadge [FBI,LSPD,OFF]");
else if(strcmp(params,"lspd",true) == 0)
{
SetPlayerColor(playerid,COLOR_BLUE);
SendClientMessage(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"fbi",true) == 0)
{
SetPlayerColor(playerid,COLOR_LIGHTERBLUE);
SendClientMessage(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"off",true) == 0)
{
SetPlayerColor(playerid,COLOR_WHITE);
SendClientMessage(playerid, COLOR_WHITE, "You're badge has been removed");
}
return 1;
}
//---End of command---//
I added isnull because if they just wrote /hbadge then a message would say them "Correct Usage:blah blah blah.."
Everything works perfect... The badge works..
But when I type only /hbadge the SendClientMessage with correct usage doesn't show up.. Please help..
If you think should use sscanf please mention how...
I say again.. I am a noob scripter..not as pro like you all..
Thanks...
Graceful if you help..
I used sscanf.. But I can't use it properly so I am using isnull..
First I defined these things at the top of my gamemode.
//---Some functions---//
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
//----end of these functions---//
Then I used this command...(I use i-zcmd to make commands..)
CMD:hbadge(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /hbadge [FBI,LSPD,OFF]");
else if(strcmp(params,"lspd",true) == 0)
{
SetPlayerColor(playerid,COLOR_BLUE);
SendClientMessage(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"fbi",true) == 0)
{
SetPlayerColor(playerid,COLOR_LIGHTERBLUE);
SendClientMessage(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"off",true) == 0)
{
SetPlayerColor(playerid,COLOR_WHITE);
SendClientMessage(playerid, COLOR_WHITE, "You're badge has been removed");
}
return 1;
}
//---End of command---//
I added isnull because if they just wrote /hbadge then a message would say them "Correct Usage:blah blah blah.."
Everything works perfect... The badge works..
But when I type only /hbadge the SendClientMessage with correct usage doesn't show up.. Please help..
If you think should use sscanf please mention how...
I say again.. I am a noob scripter..not as pro like you all..
Thanks...
Graceful if you help..