problems with some commands
#1

This cmd asking for help doesnt really work, when you type long words it will show to the admins, but the reason wont be shown

pawn Код:
dcmd_#(playerid, params[])
{
    new pid, string[210];
        if(sscanf(params, "us", pid, params[2])) return SendClientMessage(playerid, Yellow, "Usage: /# <message>");
    new help[MAX_PLAYER_NAME];
    GetPlayerName(playerid, help, sizeof(help));
    format(string, sizeof(string), "( # ) %s(ID: %i)",help, playerid, pid, params[2]);
    MessageToAdmins(AdminColor, string);
    SendClientMessage(playerid, Yellow, "Your message has been sent to admins.");
    return 1;
}
also when someone disconnects, get banned, gets kicked, or crashes, the leave messages doesnt work

Here is the code

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    if(playerid == g_DuelingID1 || playerid == g_DuelingID2)
    g_DuelInProgress = 0;
    GetPlayerName(playerid, name, sizeof(name));
    new string[64];
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server (Timedout)", name);
        case 1: format(string, sizeof(string), "%s has left the server (Leaving)", name);
        case 2: format(string, sizeof(string), "%s has left the server (Kicked)", name);
    }
    {
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
        new pid, string[128]; // MAX string is 128! You can also calculate how big string you need...
        new help[MAX_PLAYER_NAME];
        GetPlayerName(playerid, help, 24);
        format(string, 128, "( # ) %s(ID: %i)",help, playerid, pid, text);
        MessageToAdmins(AdminColor, string);
        SendClientMessage(playerid, Yellow, "Your message has been sent to admins.");
        return 0;
    }
}
Now just do #[text]
And the second problem:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    if(playerid == g_DuelingID1 || playerid == g_DuelingID2)
    g_DuelInProgress = 0;
    GetPlayerName(playerid, name, sizeof(name));
    new string[64];
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server (Timedout)", name);
        case 1: format(string, sizeof(string), "%s has left the server (Leaving)", name);
        case 2: format(string, sizeof(string), "%s has left the server (Kicked)", name);
    }
    SendClientMessageToAll(Yellow, string);
    {
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
You forgot to add SendClientMessageToAll, also change the color to your desired color.
Reply
#3

the # one, says i need to return a value, should i replace the return 0, to 1?

my onplayertext

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(Muted[playerid] == 1)
    SendClientMessage(playerid, Red, "You are muted and cannot talk");
    if(text[0] == '#')
    {
        new pid, string[128];
        new help[MAX_PLAYER_NAME];
        GetPlayerName(playerid, help, 24);
        format(string, 128, "( # ) %s(ID: %i)",help, playerid, pid, text);
        MessageToAdmins(AdminColor, string);
        SendClientMessage(playerid, Yellow, "Your message has been sent to admins.");
        return 0;
    }
}
nvm got that fixed...

but there is one problem, i want it to be a command.. like /# or /@ ..
also it doesnt show the reason only name and id ..
Reply
#4

also i have a small problem with MessageToAdmins

when someone leaves/kicked or crashed, it says it in two colors, admincolor and grey and i want it to be grey..
this is my messagetoadmins

pawn Код:
public MessageToAdmins(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdminLevel] >=1)
        {
        SendClientMessage(i, AdminColor, string);
        SendClientMessage(i, Grey, string);
        }
    }
    return 1;
}
Reply
#5

pawn Код:
public MessageToAdmins(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdminLevel] >=1)
        {
        SendClientMessage(i, Grey, string);
        }
    }
    return 1;
}
Reply
#6

the admin chat, is with admincolor...so i need two colors grey and admin color, there you just removed the admincolor
Reply
#7

No, what this will do is it will send 2 msgs, one in grey and one in admincolor, so yea... ^^
Reply
#8

but i only want the join/leaves messages in grey and admin chat in admincolor.. so how can i make that
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)