SA-MP Forums Archive
Need advice - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need advice (/showthread.php?tid=178434)



Need advice - Voldemort - 22.09.2010

pawn Код:
CMD:a(playerid,params[])
{
    AdminChats(playerid,params[]);// 1
    return 1;
}
CMD:admin(playerid,params[])
{
    AdminChats(playerid,params[]); // 2
    return 1;
}
AdminChats(playerid,params[])
{
    if (Pinfo[playerid][Admin] >= 1)
    {
        new string[256],text[256],idx;
        GetStringText(params, idx, text);
        if(!strlen(text))
        {
            SCM(playerid, COLOR_GRAD1, "TIP: /a [text]");
            return 1;
        }
        format(string, sizeof(string), "  Admin chat %s: %s", PlayerName[playerid],text);
        SendMessageToAdmin(COLOR_LIGHTGREEN,string,1);
    }
    return 1;
}
1,2 error 029: invalid expression, assumed zero

I just can't understand whats wrong, or I need to make it in different way?


Re: Need advice - iggy1 - 22.09.2010

Which line is invalid expession?

EDIT: I see the comments now


Re: Need advice - Retardedwolf - 22.09.2010

Eh didn't you need a public or stock infront of AdminCharts?

If not maybe
pawn Код:
AdminChats(playerid,params);



Re: Need advice - Kyosaur - 22.09.2010

pawn Код:
CMD:a(playerid,params[])
{
    AdminChats(playerid,params);// 1
    return 1;
}
CMD:admin(playerid,params[])
{
    AdminChats(playerid,params); // 2
    return 1;
}
AdminChats(playerid,params[])
{
    if (Pinfo[playerid][Admin] >= 1)
    {
        new string[256],text[256],idx;
        GetStringText(params, idx, text);
        if(!strlen(text))
        {
            SCM(playerid, COLOR_GRAD1, "TIP: /a [text]");
            return 1;
        }
        format(string, sizeof(string), "  Admin chat %s: %s", PlayerName[playerid],text);
        SendMessageToAdmin(COLOR_LIGHTGREEN,string,1);
    }
    return 1;
}



Re: Need advice - iggy1 - 22.09.2010

A better method than commands,

OnPlayerText
pawn Код:
if(text[0] == '#' && Pinfo[playerid][Admin] >= 1)
{
    new string[128]; GetPlayerName(playerid,string,sizeof(string));
    format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]);
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(Pinfo[i][Admin] >= 1)
        {
            SendClientMessage(i, ADMIN_COLOR, string);
        }
    }
    return 0;
}
Anything after '#' will be sent to admins


Re: Need advice - Voldemort - 22.09.2010

Oghh..,,, Thank you guys