How to?
#1

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;
}
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

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.
Reply
#5

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.
Reply
#6

Код:
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.
Reply
#7

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).
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)