/skiptut doesn't work
#1

Hey, on my server /skiptut doesn't work and I don't know why it doesnt.

Here is the code:

Код:
CMD:skiptut(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4)
	{
 		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
   		return 1;
 	}
	if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 	{
  		SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
		return 1;
	}
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid))
		return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /skiptut [playerid/partofname]");
	if(PlayerInfo[giveplayerid][pTut]) return SendClientMessage(playerid, COLOR_GREY, "Player is not in the tutorial.");
	if(IsPlayerConnected(giveplayerid))
	{
	  Tut[giveplayerid] = SetTimerEx("TutFinal", 200, false, "i", giveplayerid);
	  KillTimer(Tut[giveplayerid]);
	}
	return 1;
}
Reply
#2

Код:
CMD:skiptut(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4)
	{
 		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
 	}
	if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 	{
  		SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
	}
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid))
		return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /skiptut [playerid/partofname]");
	if(PlayerInfo[giveplayerid][pTut]) return SendClientMessage(playerid, COLOR_GREY, "Player is not in the tutorial.");
	if(IsPlayerConnected(giveplayerid))
	{
	  Tut[giveplayerid] = SetTimerEx("TutFinal", 200, false, "i", giveplayerid);
	  KillTimer(Tut[giveplayerid]);
	}
	return 1;
}
Don't really know if it'll work, I gave it a try.
Reply
#3

OG Killo, don't forget the returns in the first two if statements.

Let's say you are admin level 2; you'll get the message that you're not admin level 4! But since no returned is used, if will keep going with the code and you will be avaible to use the command!

@AdzeeH: It is not working because you kill the timer that calls "TutFinal()"! And because it's killed it won't call the TutFinal() callback. Try to comment or remove that line, and then test again. Let me know if it worked or not. There's nothing wrong with your code except the KillTimer part!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)