SA-MP Forums Archive
How to make a players id(name) appear here - 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 make a players id(name) appear here (/showthread.php?tid=470058)



How to make a players id(name) appear here - D3vin - 16.10.2013

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


Re: How to make a players id(name) appear here - Ayumi - 16.10.2013

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?


Re: How to make a players id(name) appear here - D3vin - 16.10.2013

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


Re: How to make a players id(name) appear here - Pottus - 16.10.2013

Why bother using sscanf() ? isnull() would suffice.


Re: How to make a players id(name) appear here - D3vin - 16.10.2013

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


Re: How to make a players id(name) appear here - Pottus - 16.10.2013

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.


Re: How to make a players id(name) appear here - D3vin - 16.10.2013

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?


Re: How to make a players id(name) appear here - Pottus - 16.10.2013

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.");