/skiptutorial - 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: /skiptutorial (
/showthread.php?tid=612194)
/skiptutorial -
GoldenLion - 15.07.2016
Hi, I want /skiptutorial to work in the tutorial. All other commands must not work, except /skiptutorial. I tried making it with strfind, but it doesn't seem to work. There is also /unmute command which works when you are muted, but all other commands don't work when you are muted. I made /skiptutorial the same way, but it doesn't work. Anyways here's the code:
Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > 0 || PlayerData[playerid][pKilled] > 0 || PlayerData[playerid][pHospital] != -1))
return 0;
if (PlayerData[playerid][pTutorial] > 0 && strfind(cmdtext, "/skiptutorial", true))
return 0;
if (PlayerData[playerid][pMuted] && strfind(cmdtext, "/unmute", true))
{
SendErrorMessage(playerid, "You are muted by the system.");
return 0;
}
pTutorialStage doesn't affect it, because it's the other tutorial, pTutorial is the main one. What's wrong with it?
Re: /skiptutorial -
gurmani11 - 15.07.2016
make this pTutorial a bool in your PlayerData enum which will be easy to use
PHP код:
//bool:pTutorial;
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > 0 || PlayerData[playerid][pKilled] > 0 || PlayerData[playerid][pHospital] != -1))
return 0;
if (PlayerData[playerid][pTutorial] == true)
return 0;
if (PlayerData[playerid][pMuted])
{
SendErrorMessage(playerid, "You are muted by the system.");
return 0;
}
return 1;
}
Re: /skiptutorial -
GoldenLion - 15.07.2016
No, there is pTutorial already, the problem is that I can't do /skiptutorial when in the tutorial. I want /skiptutorial to be the only command that will work while being in the tutorial.
Re: /skiptutorial -
gurmani11 - 15.07.2016
ok put it in ur skip tutorial command
PHP код:
CMD:skiptutorial(playerid,params[])
{
if(PlayerData[playerid][pTutorial] == 0) return SendClientMessage(playerid,-1, "You are not in tutorial.");
}
this will be set as this
PHP код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > 0 || PlayerData[playerid][pKilled] > 0 || PlayerData[playerid][pHospital] != -1))
return 0;
if (PlayerData[playerid][pMuted] && strfind(cmdtext, "/unmute", true))
{
SendErrorMessage(playerid, "You are muted by the system.");
return 0;
}
return 1;
}
Re: /skiptutorial -
GoldenLion - 15.07.2016
No, doing that will allow commands during the tutorial. What I need is that it returns 0 when you type any command except /skiptutorial.
Re: /skiptutorial -
gurmani11 - 15.07.2016
here you go if i understood it right this time
PHP код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > 0 || PlayerData[playerid][pKilled] > 0 || PlayerData[playerid][pHospital] != -1))
return 0;
if (PlayerData[playerid][pTutorial] > 0)
{
if(strfind(cmdtext, "/skiptutorial", true)) return 1;
else return 0;
}
if (PlayerData[playerid][pMuted] && strfind(cmdtext, "/unmute", true))
{
SendErrorMessage(playerid, "You are muted by the system.");
return 0;
}
return 1;
}
Re: /skiptutorial -
GoldenLion - 15.07.2016
Yeah, as you could see I had the same code. Anyways I found the problem, I didn't set pTutorialStage to 0 after sending player to the main tutorial so it was returning 0 when I was typing a command.