/updates
#1

Hello people, I want to script a cmd called /updates which shows the newest updates added to the script, and the owner/scripter can add it manually in game an example will make it more clear, commands used "/addupdate, /editupdate,/removeupdate,/updates"

For example, lets consider that i am the scripter and i have added a new event system in the server.

I will go in the server and login and do /addupdate, syntax would come back saying "/addupdate [update text] [Type] " types are a like that "implemented" "pending gmx" "bugfix"

I believe its clear enough, i guess that i know how to make it but i am hesitating to start and not sure if i am right or no, should i first make enums for the updates then just go ahead making the cmds? Or i should add any function/stock first??
Reply
#2

The best way to do this is through MySQL (you shouldn't even need to store data locally throughout the script). This also allows updates to be added out of the server dynamically during runtime.
Reply
#3

Use the means and the resources you want to use, you're the artist you choose which color the paint will be.

If you are stuck with actual code, come back here.
Reply
#4

Alright, I gave it a try, but seems like there is something wierd, I'm getting 26 errors after adding these commands..

Код:
enum updateinfo
{
	updatetype,
	updateimplemented,
	updatefix,
	updatepending,
	updatetext
}
That's the enum..

Код:
CMD:addupdate(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] > 99999)
	{
			new string[128];
			new type;
			if(sscanf(params, "s[128]d", updatetext, type)){
			SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addupdate [update text] [type]");
			SendClientMessageEx(playerid, COLOR_GREY, "Available Types: 1=Implemented, 2=Bug Fix, 3=Pending Restart.");
			return 1;
		}
	if(updatetext > string)
	{
			SendClientMessageEx(playerid, COLOR_RED, "ERROR:Text cannot be more than 128 characters!");
	}
	if(strcmp(type, 1, true) == 0)
	{
			UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented];
	}
	if(strcmp(type, 2, true) == 0)
	{
			UpdateInfo[i][updatetype] = UpdateInfo[i][updatefix];
	}
	if(strcmp(type, 3, true) == 0)
	{
			UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending];
	}
	else return SendClientMessageEx(playerid, COLOR_RED, "ERROR: Unknown Update Type!");
	return 1;
	}
   else return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are not authorized to use this command!");
   return 1;
}
That's the code for adding an update.

Код:
CMD:updates(playerid, params[])
{
	new string[128];
    SendClientMessageEx(playerid,COLOR_RED, "--------------[Nyakos City Roleplay Updates]--------------");
    format(string, sizeof(string), "Version: %s", SERVER_GM_TEXT);
    SendClientMessageEx(playerid, COLOR_YELLOW, string);
	if(UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented])
	{
	       format(string, sizeof(string), "{008E21}[Implemented]{008E21} %s ", updatetext);
           SendClientMessageEx(playerid, COLOR_WHITE, string);
		   return 1;
	}
	else if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending])
	{
		   format(string, sizeof(string), "{EBFF00}[Pending Restart]{EBFF00} %s", updatetext);
		   SendClientMessageEx(playerid, COLOR_WHITE, string);
		   return 1;
	}
	else if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatefix])
	{
		   format(string, sizeof(string), "{FF00DA}[Bug Fix]{FF00DA} %s", updatetext);
		   SendClientMessageEx(playerid, COLOR_WHITE, string);
		   return 1;
	}
	return 1;
}
Cmd for showing updates available for any player.. What are the mistakes which I've done?
Reply
#5

You're missing the closing bracket to your admin level check:
pawn Код:
CMD:addupdate(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 99999)
    {
        new string[128];
        new type;
        if(sscanf(params, "s[128]d", updatetext, type)){
            SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addupdate [update text] [type]");
            SendClientMessageEx(playerid, COLOR_GREY, "Available Types: 1=Implemented, 2=Bug Fix, 3=Pending Restart.");
            return 1;
        }  

    if(updatetext > string)
    {
            SendClientMessageEx(playerid, COLOR_RED, "ERROR:Text cannot be more than 128 characters!");
    }

    if(strcmp(type, 1, true) == 0)
    {
            UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented];
    }

        else if(strcmp(type, 2, true) == 0)
    {
            UpdateInfo[i][updatetype] = UpdateInfo[i][updatefix];
    }

    else if(strcmp(type, 3, true) == 0)
    {
            UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending];
    }

    else return SendClientMessageEx(playerid, COLOR_RED, "ERROR: Unknown Update Type!");
    return 1;
   }
   else return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are not authorized to use this command!");
   return 1;
}
Reply
#6

still getting same 26 errors..

F:\SA-MP server\credit goes to mason\ogg\pawno\include\YSI\..\YSI_Coding\..\YSI_C oding\y_malloc/heapalloc.inc(12 : error 017: undefined symbol "Malloc_main"
F:\SA-MP server\credit goes to mason\ogg\pawno\include\sscanf2.inc(172) : error 017: undefined symbol "SSCANF_OnGameModeInit"
F:\SA-MP server\credit goes to mason\ogg\pawno\include\sscanf2.inc(203) : error 017: undefined symbol "SSCANF_OnPlayerConnect"
F:\SA-MP server\credit goes to mason\ogg\pawno\include\sscanf2.inc(227) : error 017: undefined symbol "SSCANF_OnPlayerDisconnect"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(30) : warning 201: redefinition of constant/macro (symbol "isnull(%1)")
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(4572) : error 021: symbol already defined: "SpeedCameras"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(7435) : error 017: undefined symbol "SavePlant"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(8292) : error 017: undefined symbol "ClearCrimes"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9491) : error 017: undefined symbol "LoadHGBackpacks"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(974 : error 017: undefined symbol "AddNationQueue"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9766) : error 017: undefined symbol "AddNationQueue"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9873) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9874) : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9915) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9916) : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9941) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9942) : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9970) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(9971) : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10000) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10001) : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10030) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10031) : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10057) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(1005 : error 017: undefined symbol "MySQLBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10083) : error 017: undefined symbol "SystemBan"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(10084) : error 017: undefined symbol "MySQLBan"
Reply
#7

Anyone?
Reply
#8

Those errors are more likely from elsewhere... What I would be worried about is why the command isn't making undefined symbol i...


Have you used shitty pragmas to suppress errors? I highly advise you to not do that if this is the case...


Also 24 hour bumps only.
Reply
#9

This is what happens when you blatantly use other's script. Go fix sscanf include first, that's the root cause of this problem.
Reply
#10

It's not the first time to compile this script my server is online with it lol..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)