sscanf Z parameter.
#5

Quote:
Originally Posted by Rachael
Посмотреть сообщение
You could use the optional specifier option
pawn Код:
if(sscanf(params,"s[50]I(-1)", string , slot ))
This will allow the code to process the string, and ignore the next parameter until it is needed.
Yea, i just figured it out.
I was a dumbass and didn't look in the sscanf official post.

Код:
CMD:house(playerid, params[])
{
	new string[256], slot;
    if(sscanf(params,"s[256]I(1)", string, slot)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /house [buy/sell/lock/unlock/putgun/takegun/inventory]");
    if(!strcmp(string, "buy", true))
    {
		BuyHouseForPlayer(playerid);
		return 1;
    }
    if(!strcmp(string, "sell", true))
    {
		SellHouseForPlayer(playerid);
		return 1;
    }
    if(!strcmp(string, "lock", true))
    {
		LockPlayerHouse(playerid);
		return 1;
    }
    if(!strcmp(string, "unlock", true))
    {
		UnlockPlayerHouse(playerid);
		return 1;
    }
    if(!strcmp(string, "putgun", true))
    {
		PutGunPlayerHouse(playerid, slot);
		return 1;
    }
    if(!strcmp(string, "takegun", true))
    {
		TakeGunPlayerHouse(playerid, slot);
		return 1;
    }
    if(!strcmp(string, "inventory", true))
    {
		CheckPlayerHouseInventory(playerid);
		return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /house [buy/sell/lock/unlock/putgun/takegun/inventory]");
    }
	return 1;
}
Reply


Messages In This Thread
sscanf Z parameter. - by Shetch - 11.04.2012, 07:27
Re: sscanf Z parameter. - by zSuYaNw - 11.04.2012, 07:36
Re: sscanf Z parameter. - by Shetch - 11.04.2012, 07:43
Re: sscanf Z parameter. - by Rachael - 11.04.2012, 07:51
Re: sscanf Z parameter. - by Shetch - 11.04.2012, 07:56

Forum Jump:


Users browsing this thread: 1 Guest(s)