Some help with a command's parameters separation
#1

Hi, so, I was wondering how you could make a command for example of this nature:

Код:
/event Title|Location|Prize|Time|Description
However, the people who type the command will actually have to put these in: |, for example:

Код:
/event Race|Las Venturas Highway|A lesson on drifting|06:00|We're waiting for you all on the East Side Highway.
As you can see, they have to put the |'s in. If they don't do that, and I just do the regular old strings with sscanf, then it would come up with (what I don't want):

Код:
Event Race at Las with the prize Venturas at the time of Highway hours. Some information: A
What I want it to be is...:

Код:
Event Race at Las Venturas Highway with the prize A lesson on drifting at the time of 06:00 hours. Some information: We're waiting for you all on the East Side Highway.
All I really need to know is how to add the separators in the syntax of the command, how to make it so the people have to add |'s between their event information.

PS: I'm using YCMD and sscanf, if you could relate to that, that'd be great.

I'd appreciate any help whatsoever as I am really struggling with this issue.
Reply
#2

Im sure you could do something like this

Код:
CMD:seteventtype(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pHelper] >= 3 || PlayerInfo[playerid][pDonateRank] >= 4)
	{
		if(EventKernel[EventCreator] == playerid || PlayerInfo[playerid][pAdmin] >= 4)
		{
			if(isnull(params))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /seteventtype [type]");
				SendClientMessageEx(playerid, COLOR_GREY, "Available names: DM, TDM, Race");
				return 1;
			}
Edit: And a seteventpos to set the start position and then when you set the event type to "race" you create checkpoints and laps?
Reply
#3

Quote:
Originally Posted by JME
Посмотреть сообщение
Im sure you could do something like this

Код:
CMD:seteventtype(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pHelper] >= 3 || PlayerInfo[playerid][pDonateRank] >= 4)
	{
		if(EventKernel[EventCreator] == playerid || PlayerInfo[playerid][pAdmin] >= 4)
		{
			if(isnull(params))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /seteventtype [type]");
				SendClientMessageEx(playerid, COLOR_GREY, "Available names: DM, TDM, Race");
				return 1;
			}
I considered this earlier, thanks for your help, but I don't want it like this. I've seen it on another server, not naming names, so it is possible.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)