SA-MP Forums Archive
Admin Message - 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: Admin Message (/showthread.php?tid=359535)



Admin Message - Tuntun - 14.07.2012

Hello
i need a help with a new script...
i need help with a admin message system... the cmd's : /admin [message]
if players do /admin Hi so the message will be go to admin in a small box.. and the admins can do /ram playerid/player
name [message]... please help me with create this cmd's...


Re: Admin Message - Devilxz97 - 14.07.2012

like /a ?
if yes there u are , use ZCMD

pawn Код:
CMD:a(playerid, params[])
{
    new string[512];
    new pName[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][pAdmin] >= 1) //i dont know your admin variables xD
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) == 1)
            GetPlayerName(playerid, Name, sizeof(Name));
            format(string, sizeof(string), "[ADMINCHAT]:%s ( %s )", pName, params);
            SendClientMessage(i, COLOR_WHITE,string);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "[ERROR]:You need to be an [ADMIN] to use this Commands!");
    }
    return 1;
}
if works Rep+ me


Re: Admin Message - [MM]RoXoR[FS] - 14.07.2012

Remember to REPLACE pInfo[playerid][Admin] with your Admin Variable


Re: Admin Message - Tuntun - 14.07.2012

1 error
F:\Copy of test.pwn(13) : warning 203: symbol is never used: "dcmd_ram"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.


Re: Admin Message - Devilxz97 - 14.07.2012

Quote:
Originally Posted by Tuntun
Посмотреть сообщение
1 error
F:\Copy of test.pwn(13) : warning 203: symbol is never used: "dcmd_ram"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(admin,5,cmdtext);//admin command
    dcmd(ram,3,cmdtext);//ram command
    return 0;
}



Re: Admin Message - Tuntun - 14.07.2012

Like this?:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(admin,5,cmdtext);//admin command
dcmd(ram,3,cmdtext);//ram command
return 0;
}
dcmd_ram(playerid,params[])
{
new msg[200],targetid;
if(pInfo[playerid][Admin]< 1 || !IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"You are not allowed to use this cmd");
if(sscanf(params,"us[120]",targetid,msg)) return SendClientMessage(playerid,-1,"Correct Usage : /ram [id] [message]");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"[ADMIN] %s : %s",name,msg);
SendClientMessage(targetid,-1,msg);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(admin,5,cmdtext);//admin command
dcmd(ram,3,cmdtext);//ram command
return 0;
}


Re: Admin Message - [MM]RoXoR[FS] - 14.07.2012

pawn Код:
#include <a_samp>
#include <sscanf2>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(admin,5,cmdtext);//admin command
    dcmd(ram,3,cmdtext);//ram command
    return 0;
}

dcmd_admin(playerid,params[])
{
    new msg[120];
    if(sscanf(params,"s[120]",msg)) return SendClientMessage(playerid,-1,"Correct Usage : /admin [message]");
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(msg,sizeof(msg),"%s(ID:%d) : %s",name,playerid,msg);
    for(new i=0;i<MAX_PLAYERS;++i)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i) || pInfo[i][Admin]>=1)
                SendClientMessage(i,-1,msg);
        }
    }
    return 1;
}
dcmd_ram(playerid,params[])
{
    new msg[200],targetid;
    if(pInfo[playerid][Admin]< 1 && !IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"You are not allowed to use this cmd");
    if(sscanf(params,"us[120]",targetid,msg)) return SendClientMessage(playerid,-1,"Correct Usage : /ram [id] [message]");
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(msg,sizeof(msg),"[ADMIN] %s : %s",name,msg);
    SendClientMessage(targetid,-1,msg);
    return 1;
}



Re: Admin Message - Tuntun - 14.07.2012

F:\Copy of test.pwn(23) : error 017: undefined symbol "pInfo"
F:\Copy of test.pwn(23) : warning 215: expression has no effect
F:\Copy of test.pwn(23) : error 001: expected token: ";", but found "]"
F:\Copy of test.pwn(23) : error 029: invalid expression, assumed zero
F:\Copy of test.pwn(23) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Re: Admin Message - clarencecuzz - 14.07.2012

Change line 23 to:
pawn Код:
if(IsPlayerAdmin(i))



Re: Admin Message - Tuntun - 14.07.2012

#include <a_samp>
#include <sscanf2>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(admin,5,cmdtext);//admin command
dcmd(ram,3,cmdtext);//ram command
return 0;
}

dcmd_admin(playerid,params[])
{
new msg[120];
if(sscanf(params,"s[120]",msg)) return SendClientMessage(playerid,-1,"Correct Usage : /admin [message]");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"%s(ID:%d) : %s",name,playerid,msg);
for(new i=0;i<MAX_PLAYERS;++i)
{
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
SendClientMessage(i,-1,msg);
}
}
return 1;
}
dcmd_ram(playerid,params[])
{
new msg[200],targetid;
if(pInfo[playerid][Admin]< 1 && !IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"You are not allowed to use this cmd");
if(sscanf(params,"us[120]",targetid,msg)) return SendClientMessage(playerid,-1,"Correct Usage : /ram [id] [message]");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"[ADMIN] %s : %s",name,msg);
SendClientMessage(targetid,-1,msg);
return 1;
}
And the Errors:

F:\Copy of test.pwn(31) : error 017: undefined symbol "pInfo"
F:\Copy of test.pwn(31) : warning 215: expression has no effect
F:\Copy of test.pwn(31) : error 001: expected token: ";", but found "]"
F:\Copy of test.pwn(31) : error 029: invalid expression, assumed zero
F:\Copy of test.pwn(31) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.