Need example
#1

Can someone give me example how to do something like this with sscanf_dcmd?

Код:
dcmd_reset(playerid,params[])
{
	if(!params[0]) return SendClientMessage(playerid,COLOR,"/reset money || weapons");
	
	if(!strcmp(***, "money", true))
	{
	  if(!***) return SendClientMessage(playerid,COLOR,"/reset money ID");
        ResetMoney..
	}

if(!strcmp(***, "weapons", true))
	{
	  if(!***) return SendClientMessage(playerid,COLOR,"/reset weapons ID");
        ResetWeapons..
	}
	return 1;
}
When I'm trying to do money/weapons and ID doesn't works.. Works just first part.. I need example with sscanf. Thanks.
Reply
#2

Should work

pawn Код:
dcmd_reset(playerid, params[])
{
    new selection[8], giveplayerid;
    if(sscanf(params, "si", selection, giveplayerid)) return SendClientMessage(playerid,COLOR,"/reset money || weapons");

    if(!strcmp(selection, "money", true, 5))
    {
        ResetPlayerMoney(giveplayerid);
    }
    else if(!strcmp(selection, "weapons", true, 7))
    {
        ResetPlayerWeapons(giveplayerid);
    }
    return 1;
}
Reply
#3

What means 8? If it means letters, selection is with 9 letters. Or it's from 0 to 8?
Reply
#4

Код:
dcmd_reset(playerid, params[])
{
new selection[8], giveplayerid;
if(sscanf(params, "s", selection)) return SendClientMessage(playerid,COLOR,"/reset money || weapons");

if(!strcmp(selection, "money", true, 5))
{
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid,COLOR,"/reset money ID");
ResetPlayerMoney(giveplayerid);
}
else if(!strcmp(selection, "weapons", true, 7))
{
ResetPlayerWeapons(giveplayerid);
}
return 1;
}
I'm trying to do like this, but server shows that wrong ID. Sorry for double posting.
Reply
#5

Sorry for triple posting, but I've fixed it. Thanks.
Reply


Forum Jump:


Users browsing this thread: