/skiptutorial
#1

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?
Reply
#2

make this pTutorial a bool in your PlayerData enum which will be easy to use

PHP код:
//bool:pTutorial;
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if (!
SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > || PlayerData[playerid][pKilled] > || 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;

Reply
#3

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.
Reply
#4

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(playeridcmdtext[])
{
    if (!
SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > || PlayerData[playerid][pKilled] > || 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

Reply
#5

No, doing that will allow commands during the tutorial. What I need is that it returns 0 when you type any command except /skiptutorial.
Reply
#6

here you go if i understood it right this time
PHP код:
public OnPlayerCommandReceived(playeridcmdtext[]) 

    if (!
SQL_IsLogged(playerid) || (PlayerData[playerid][pTutorialStage] > || PlayerData[playerid][pKilled] > || 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;  

Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)