Help with if inputtext is 200 - 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: Help with if inputtext is 200 (
/showthread.php?tid=353751)
Help with if inputtext is 200 -
Stefand - 24.06.2012
Hey,
I made a /skin command, then you can enter a skin id.
But some skins are not allowed to choose.
so I tried this...
pawn Код:
case 3859:
{
if(strlen(inputtext) >= 1)
{
if(strlen(inputtext) == 200)
{
SCM(playerid, RED, "You can't choose this skin");
}
else
{
Player[playerid][LastSkin] = strval(inputtext);
SetPlayerSkin(playerid, strval(inputtext));
}
}
else
{
SendClientMessage(playerid, WHITE, "Must be longer than 1 char.");
}
}
but that doesn't work.
the command:
pawn Код:
command(skin, playerid, params[])
{
#pragma unused params
if(Player[playerid][Human] == 1)
{
ShowPlayerDialog(playerid, 3859, DIALOG_STYLE_INPUT, "Change skin", "Please select a new, roleplay skin.", "Change", "Cancel");
}
else if(Player[playerid][Zombie] == 1)
{
SCM(playerid, RED, "Zombies can't set there skin");
}
return 1;
}
Re: Help with if inputtext is 200 -
iggy1 - 24.06.2012
You are using
strlen and it should be
strval.
pawn Код:
case 3859:
{
if(strlen(inputtext))
{
new skinid = strval(inputtext);
if(skinid == 200)
{
SCM(playerid, RED, "You can't choose this skin");
}
else
{
if(skinid > -1 && skinid < 300)
{
Player[playerid][LastSkin] = strval(inputtext);
SetPlayerSkin(playerid, strval(inputtext));
}
else
{
SCM(playerid, RED, "Invalid skin id.");
}
}
}
else
{
SendClientMessage(playerid, WHITE, "Must be longer than 0 char.");
}
}
This checks for valid skins too.
Re: Help with if inputtext is 200 -
Stefand - 24.06.2012
Thanks!!