/asay command help? -
Tass007 - 03.02.2016
Hi, I'm a really noob, I've tried to do this but I'm not very good. This is the code I have so far
PHP код:
CMD:asay(playerid, params[])
{
new tmp[256], playername[25], tmp2[256],string[256];
if (adlvl[playerid] < 1) return 0;
if (sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /asay [message]");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Administrator: %s", tmp);
SendClientMessageToAll(COL_LEVEL1, string);
else
{
if(adlvl[playerid] < 2) return 0;
SendClientMessageToAll(COL_LEVEL2, string);
else
{
if(adlvl[playerid] < 3) return 0;
SendClientMessageToAll(COL_LEVEL3, string);
else
{
if(adlvl[playerid] < 4) return 0;
SendClientMessageToAll(COL_LEVEL4, string);
if (adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: [asay] %s: %s.", playername, tmp);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[asay] %s: %s", playername, tmp);
return 1;
}
If you could be so kind to go into detail about what you are doing to fix this. Would be very greatful.
As all ways who ever helps +1 Rep
Thanks for your time.
Re: /asay command help? -
Zamora - 03.02.2016
pawn Код:
CMD:asay(playerid, params[])
{
new tmp[256], playername[25], tmp2[256],string[256];
if (adlvl[playerid] < 1) return 0;
if(sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /asay [message]");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Administrator: %s", tmp);
SendClientMessageToAll(COL_LEVEL1, string);
else
{
if(adlvl[playerid] < 2) return 0;
SendClientMessageToAll(COL_LEVEL2, string);
else
{
if(adlvl[playerid] < 3) return 0;
SendClientMessageToAll(COL_LEVEL3, string);
else
{
if(adlvl[playerid] < 4) return 0;
SendClientMessageToAll(COL_LEVEL4, string);
}
if(adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: [asay] %s: %s.", playername, tmp);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[asay] %s: %s", playername, tmp);
return 1;
}
I don't know what is the main proplem you are facing, but you had a missing bracket.
Re: /asay command help? -
Tass007 - 03.02.2016
Sorry, I should of explained it better. When I go in game. Type /asay I get all the messages. Like 4 of them but just with different colors. I want it the way so that depending on the admin level is the color the a say will be. But I will try this. Thank you.
Re: /asay command help? -
Zamora - 03.02.2016
pawn Код:
CMD:asay(playerid, params[])
{
new tmp[256], playername[25], tmp2[256],string[256];
if (adlvl[playerid] < 1) return 0;
if(sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /asay [message]");
if(adlvl[playerid] == 1)
{
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Administrator: %s", tmp);
SendClientMessageToAll(COL_LEVEL1, string);
}
else if(adlvl[playerid] == 2)
{
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Administrator: %s", tmp);
SendClientMessageToAll(COL_LEVEL2, string);
}
else if(adlvl[playerid] == 3)
{
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Administrator: %s", tmp);
SendClientMessageToAll(COL_LEVEL3, string);
}
else if(adlvl[playerid] == 4)
{
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
format(tmp2, sizeof(tmp2), "say %s", tmp);
format(string, sizeof(string), "* Administrator: %s", tmp);
SendClientMessageToAll(COL_LEVEL4, string);
}
if(adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: [asay] %s: %s.", playername, tmp);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[asay] %s: %s", playername, tmp);
return 1;
}
Here it is
Edit: Missed a bracket.
Re: /asay command help? -
Tass007 - 03.02.2016
Thank you! +1 Rep