How do I convert this to sscanf - 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 do I convert this to sscanf (
/showthread.php?tid=311259)
How do I convert this to sscanf -
rati555 - 15.01.2012
pawn Код:
CMD:cap(playerid, params[])
{
new skin, id = strval(params[0]), cap, slot = GetEmptySlot(playerid), count;
if(id <= 0 || id > 9) return SendClientMessage(playerid, 0xFFFFFFAA, "(Error) Syntax: /cap [1 - 9]");
skin = (GetPlayerSkin(playerid) - 1);
switch(id)
{
case 1: cap = 18926;
case 2..9: cap = 18926 + id;
}
do
{
if(skin == invalidskins[count]) return SendClientMessage(playerid, 0xFFFFFFAA, "(Error) Your skin does not support a cap.");
count++;
}
while(count < sizeof invalidskins);
if(skin < 0) skin = 0;
if(slot == -1) return SendClientMessage(playerid, 0xFFFFFFAA, "(Error) You're holding the maximum of objects possible.");
TextDrawSetString(MsgBox[playerid]," Cap placed");
TextDrawShowForPlayer(playerid, MsgBox[playerid]);
SetTimerEx("Hide", 3000, false, "d", playerid);
SetPlayerAttachedObjectEx(playerid, slot, cap, 2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
return 1;
}
Re: How do I convert this to sscanf -
Konstantinos - 15.01.2012
pawn Код:
CMD:cap(playerid, params[])
{
new
skin, id, cap, count, slot = GetEmptySlot(playerid);
if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xFFFFFFAA, "Syntax: /cap [1 - 9]");
if(id <= 0 || id > 9) return SendClientMessage(playerid, 0xFFFFFFAA, "(Error) Available IDs: [1 - 9]");
skin = (GetPlayerSkin(playerid) - 1);
switch(id) {
case 1: cap = 18926;
case 2..9: cap = 18926 + id;
}
do {
if(skin == invalidskins[count]) return SendClientMessage(playerid, 0xFFFFFFAA, "(Error) Your skin does not support a cap.");
count++;
}
while(count < sizeof invalidskins);
if(skin < 0) skin = 0;
if(slot == -1) return SendClientMessage(playerid, 0xFFFFFFAA, "(Error) You're holding the maximum of objects possible.");
TextDrawSetString(MsgBox[playerid]," Cap placed");
TextDrawShowForPlayer(playerid, MsgBox[playerid]);
SetTimerEx("Hide", 3000, false, "d", playerid);
SetPlayerAttachedObjectEx(playerid, slot, cap, 2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
return 1;
}
Re: How do I convert this to sscanf -
Jefff - 15.01.2012
For 1 argument sscanf?