SA-MP Forums Archive
How to? - 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: How to? (/showthread.php?tid=438057)



How to? - DarkB0y - 18.05.2013

How to make this command in ZCMD?

pawn Код:
if (strcmp("/News", cmdtext, true, 5) == 0)
    {
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, cmdtext, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, GREEN, string);

        }
        else
        {
        SendClientMessage(playerid, GREEN, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
        }
    return 0;
}



Re: How to? - DeMoX - 18.05.2013

You can take a look on the topic to get full help..anyways look below.

pawn Код:
#include <zcmd>//include it first.

CMD:news(playerid,params[])
{
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, cmdtext, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, GREEN, string);

        }
        else
        {
        SendClientMessage(playerid, GREEN, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
}



Re: How to? - xXitsgodzillaXx - 18.05.2013

pawn Код:
CMD:News(playerid, params[])
    {
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, params, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, 0x006400FF, string);

        }
        else
        {
        SendClientMessage(playerid, 0x006400FF, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
        }
let me know if you get any errors i didnt get any but yeah.


Re: How to? - DarkB0y - 18.05.2013

Quote:
Originally Posted by xXitsgodzillaXx
Посмотреть сообщение
pawn Код:
CMD:News(playerid, params[])
    {
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, params, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, 0x006400FF, string);

        }
        else
        {
        SendClientMessage(playerid, 0x006400FF, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
        }
let me know if you get any errors i didnt get any but yeah.
It did not show any error/warning but it did not work in game.


Re: How to? - xXitsgodzillaXx - 18.05.2013

Quote:
Originally Posted by DarkB0y
Посмотреть сообщение
It did not show any error/warning but it did not work in game.
pawn Код:
CMD:news(playerid, params[])
    {
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, params, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, 0x006400FF, string);

        }
        else
        {
        SendClientMessage(playerid, 0x006400FF, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
        }
oops try this.


AW: How to? - Blackazur - 18.05.2013

Код:
CMD:news(playerid, params[])
    {
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, params, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, 0x006400FF, string);

        }
        else
        {
        SendClientMessage(playerid, 0x006400FF, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
        }
try that.


Re: AW: How to? - NL-Sultan - 18.05.2013

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Код:
CMD:news(playerid, params[])
    {
        new file[128];
        format(file, sizeof(file), "News.ini");
        if(IsPlayerAdmin(playerid)){
        new string[256];
        strmid(string, params, 6, 256);
        dini_Set(file, "News", string);
        new thing[256];
        thing = dini_Get(file, "News");
        format(string, sizeof(string), "Server News: %s", thing);
        SendClientMessage(playerid, 0x006400FF, string);

        }
        else
        {
        SendClientMessage(playerid, 0x006400FF, "You have to be logged into RCON in order to change the News!");
        }
        return 1;
        }
You have to try this code if it's not your LAST COMMAND in your command list in your pawn file.
If it is the last command, then close it with another return (0).


Re: How to? - DarkB0y - 18.05.2013

In both it work ... But it not showing all the words Like
Server News : e <= (Welcome) to my server