How to put an admin tag onto a chat if they are admin?
#1

It was hard to explain, I got errors from this, I know I have did wrong in the code, but I cannot figure it out..

Код:
CMD:hc(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "/hc [Text]");
    new
        string[128],
        pName[MAX_PLAYER_NAME]
    ;
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[Help Chat] Player %s: %s", pName, params);
    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    else
    if(pInfo[playerid][Adminlevel] = 1)
    {
        GetPlayerName(playerid, pName, sizeof(pName));
	    format(string, sizeof(string), "[Help Chat] Mapper %s: %s", pName, params);
	    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else
	if(pInfo[playerid][Adminlevel] = 2)
    {
        GetPlayerName(playerid, pName, sizeof(pName));
	    format(string, sizeof(string), "[Help Chat] Lead Mapper %s: %s", pName, params);
	    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else
    if(pInfo[playerid][Adminlevel] = 3)
    {
        GetPlayerName(playerid, pName, sizeof(pName));
	    format(string, sizeof(string), "[Help Chat] Developer %s: %s", pName, params);
	    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else
    if(pInfo[playerid][Adminlevel] = 4)
    {
        GetPlayerName(playerid, pName, sizeof(pName));
	    format(string, sizeof(string), "[Help Chat] Lead Developer %s: %s", pName, params);
	    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:hc(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "/hc [Text]");
    new
        string[128],
        pName[MAX_PLAYER_NAME]
    ;
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[Help Chat] Player %s: %s", pName, params);
    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    else if(pInfo[playerid][Adminlevel] = 1)
    {
        format(string, sizeof(string), "[Help Chat] Mapper %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else if(pInfo[playerid][Adminlevel] = 2)
    {
        format(string, sizeof(string), "[Help Chat] Lead Mapper %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else if(pInfo[playerid][Adminlevel] = 3)
    {
        format(string, sizeof(string), "[Help Chat] Developer %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else  if(pInfo[playerid][Adminlevel] = 4)
    {
        format(string, sizeof(string), "[Help Chat] Lead Developer %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    return 1;
}

well im not best but i tryed

why put GetPlayerName every if(pInfo[playerid][Adminlevel] = 4) down ?

use only 1
Reply
#3

Less errors, but left with these;

Код:
G:\Roleplay Server\gamemodes\rp.pwn(773) : error 029: invalid expression, assumed zero
G:\Roleplay Server\gamemodes\rp.pwn(773) : warning 215: expression has no effect
G:\Roleplay Server\gamemodes\rp.pwn(773) : error 001: expected token: ";", but found "if"
G:\Roleplay Server\gamemodes\rp.pwn(773) : warning 211: possibly unintended assignment
G:\Roleplay Server\gamemodes\rp.pwn(778) : warning 211: possibly unintended assignment
G:\Roleplay Server\gamemodes\rp.pwn(783) : warning 211: possibly unintended assignment
G:\Roleplay Server\gamemodes\rp.pwn(788) : warning 211: possibly unintended assignment
Reply
#4

show line
Код:
773
778
783
788
Reply
#5

pawn Код:
CMD:hc(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "/hc [Text]");
    new
        string[128],
        pName[MAX_PLAYER_NAME]
    ;
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[Help Chat] Player %s: %s", pName, params);
    SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    else if(pInfo[playerid][Adminlevel] == 1)
    {
        format(string, sizeof(string), "[Help Chat] Mapper %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else if(pInfo[playerid][Adminlevel] == 2)
    {
        format(string, sizeof(string), "[Help Chat] Lead Mapper %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else if(pInfo[playerid][Adminlevel] == 3)
    {
        format(string, sizeof(string), "[Help Chat] Developer %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    else  if(pInfo[playerid][Adminlevel] == 4)
    {
        format(string, sizeof(string), "[Help Chat] Lead Developer %s: %s", pName, params);
        SendClientMessageToAll(COLOR_NEUTRALBLUE, string);
    }
    return 1;
}
now try this maybe will fix

if again problem errors come

then show only those lines which have errors
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)