SA-MP Forums Archive
command help - 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: command help (/showthread.php?tid=305694)



command help - Notis123 - 23.12.2011

Well i know this should be in script request topics but its not a request its ehh A BIG help.

Im trying to make a command which is /ask [sends a question to all admins] and an /apm [admin pm answer message]
but when i try and make it im getting errors
Note:i wont post the errors.
Note:But i will like your help.

Thanks i think "Kostas" will post first :P


Re: command help - SomebodyAndMe - 23.12.2011

Could u give us the whole command? Otherwise we can't help you.

PS. To bad for Kostas i'm first.


Re: command help - Notis123 - 23.12.2011

Quote:
Originally Posted by SomebodyAndMe
Посмотреть сообщение
Could u give us the whole command? Otherwise we can't help you.

PS. To bad for Kostas i'm first.
i deleted the code becoz i was pissed off with the errors

note:>.<


Re: command help - rinori - 23.12.2011

pawn Код:
forward AdminSendClientMessage(color,const string[],level);
public AdminSendClientMessage(color,const string[],level)
{
    //foreach(Player, i)
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}

CMD:ask(playerid, params[])
{
    new string[128], playername[MAX_PLAYER_NAME], result[70];
    if(sscanf(params, "s", result)) return SendClientMessage(playerid, YOUR_COLOR, "[USAGE]: /ask [question here]");
    else
    {
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "* [%d] %s: %s", playerid, playername, result);
        AdminSendClientMessage(YOUR_COLOR, string, 1);
    }
    return 1;
}

CMD:apm(playerid, params[])
{
    new string[96], playername[MAX_PLAYER_NAME],giveplayerid, giveplayername[MAX_PLAYER_NAME], result[96];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "us", giveplayerid, result)) return SendClientMessage(playerid, YOUR_COLOR, "[USAGE]: /apm [playerid]");
        if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, YOUR_COLOR, " Player is not connected!");
        else
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
            format(string, sizeof(string), "PM from admin %s: %s", playername, result);
            SendClientMessage(giveplayerid, YOUR_COLOR, string);
            format(string, sizeof(string), "PM to [%d]%s: %s", giveplayerid, giveplayername, result);
            SendClientMessage(playerid, YOUR_COLOR, string);
        }
    }
    else
    {
        SendClientMessage(playerid, YOUR_COLOR, " You are not an admin!");
    }
    return 1;
}
Use ZCMD + define the colors.


Re: command help - Notis123 - 23.12.2011

Quote:
Originally Posted by rinori
Посмотреть сообщение
pawn Код:
forward AdminSendClientMessage(color,const string[],level);
public AdminSendClientMessage(color,const string[],level)
{
    //foreach(Player, i)
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}

CMD:ask(playerid, params[])
{
    new string[128], playername[MAX_PLAYER_NAME], result[70];
    if(sscanf(params, "s", result)) return SendClientMessage(playerid, YOUR_COLOR, "[USAGE]: /ask [question here]");
    else
    {
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "* [%d] %s: %s", playerid, playername, result);
        AdminSendClientMessage(YOUR_COLOR, string, 1);
    }
    return 1;
}

CMD:apm(playerid, params[])
{
    new string[96], playername[MAX_PLAYER_NAME],giveplayerid, giveplayername[MAX_PLAYER_NAME], result[96];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "us", giveplayerid, result)) return SendClientMessage(playerid, YOUR_COLOR, "[USAGE]: /apm [playerid]");
        if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, YOUR_COLOR, " Player is not connected!");
        else
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
            format(string, sizeof(string), "PM from admin %s: %s", playername, result);
            SendClientMessage(giveplayerid, YOUR_COLOR, string);
            format(string, sizeof(string), "PM to [%d]%s: %s", giveplayerid, giveplayername, result);
            SendClientMessage(playerid, YOUR_COLOR, string);
        }
    }
    else
    {
        SendClientMessage(playerid, YOUR_COLOR, " You are not an admin!");
    }
    return 1;
}
Use ZCMD + define the colors.
ThAnK yA