Need example - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need example (
/showthread.php?tid=115115)
Need example -
lakierka - 22.12.2009
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.
Re: Need example -
bigcomfycouch - 22.12.2009
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;
}
Re: Need example -
lakierka - 22.12.2009
What means 8? If it means letters, selection is with 9 letters. Or it's from 0 to 8?
Re: Need example -
lakierka - 22.12.2009
Код:
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.
Re: Need example -
lakierka - 22.12.2009
Sorry for triple posting, but I've fixed it. Thanks.