How to make a players id(name) appear here
#1

So I've been trying to get this /suggest CMD to show the players id on a Developer message to say who is posting it and also trying to get it to show up in /suggestions when a developer uses the command in game

Код:
CMD:suggest(playerid, params[])
{
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /suggest [text]");
	if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
	new File: file = fopen("bugs.cfg", io_append), rpnstring[128];
	format(rpnstring, sizeof(rpnstring), "[%s] %s\r\n", RPN[playerid], params);
	fwrite(file, rpnstring);
	fclose(file);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your suggestions has been saved, Developers will check it once possible.");
	if(PlayerInfo[playerid][pDev] >= 1)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "%s has sent a suggestion, Please inform the developers");
	}
	return 1;
}

CMD:suggestions(playerid, params[])
{
	if(PlayerInfo[playerid][pDev] >= 1)
	{
		new rpnstring[128], File: file = fopen("bugs.cfg", io_read), idx;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "---|| Los Santos Public Roleplay Suggestions ||---:");
		while(fread(file, rpnstring))
		{
	    	format(rpnstring, sizeof(rpnstring), "%d) %s", idx, rpnstring);
	    	SendClientMessage(playerid, COLOR_LIGHTBLUE, rpnstring);
	    	idx ++;
		}
		fclose(file);
	}
	return 1;
}
Really need some help with my problem
Reply
#2

But won't the developers want to look at suggestions even if the people suggesting it are offline? So why would you need the ID?
Reply
#3

I want to know how I would add the persons name to show the developers who sent it in,, so that they would not be able to abuse it
Reply
#4

Why bother using sscanf() ? isnull() would suffice.
Reply
#5

How would that work with isnull? I've never used it before?
Reply
#6

It's basically the same as if(sscanf(params, "s[128]", params)) in this script as that line is only checking if params is null.
Reply
#7

Something like this?
Код:
CMD:suggest(playerid, params[])
{
	if(isnull(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /suggest [text]");
	if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
	new File: file = fopen("bugs.cfg", io_append), rpnstring[128];
	format(rpnstring, sizeof(rpnstring), "[%s] %s\r\n", RPN[playerid], params);
	fwrite(file, rpnstring);
	fclose(file);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your suggestions has been saved, Developers will check it once possible.");
	if(PlayerInfo[playerid][pDev] >= 1)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "%s has sent a suggestion, Please inform the developers");
	}
	return 1;
}
Or something more major?
Reply
#8

Just if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /suggest [text]");

You could use strlen for a minimum constraint as well.

if(strlen(params) < 16) return SendClientMessage(playerid, COLOR_GREY, "Minimum characters limit is 16.");
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)