/mask off and server disconnect
#1

Hey all, i have a problem. When i type '/mask on' everything is good but when i type '/mask off' the server will be exit and all disconnect, this is the code from /mask :
Код:
/* ------------------------------ /mask ------------------------------ */

    if(strcmp(cmd, "/mask", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new OldUsername[MAX_PLAYER_NAME][MAX_PLAYERS];
	        new x_nr[32];
	        x_nr = strtok(cmdtext, idx);
	        if(!strlen(x_nr))
	        {
	            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mask [ON/OFF]");
	            return 1;
	        }
	        if(strcmp(x_nr,"on",true) == 0)
			{
			    new randomID = random(200);
			    if(PlayerInfo[playerid][pMask] == 0)
		   	 	{
		   		     SendClientMessage(playerid, COLOR_GRAD1, "*!* You don't have a mask, buy one at 24/7.");
		   		     return 1;
		   		}
				for(new i = 0; i < MAX_PLAYERS; i++)
	   			{
	   		    	if(IsPlayerConnected(i))
	   		    	{
			   			ShowPlayerNameTagForPlayer(i, playerid, 0);
					}
				}
				PlayerInfo[playerid][pMaskuse] = 1;
				GetPlayerName(playerid, string, sizeof(string));
		        strmid(OldUsername[playerid], string, 0, strlen(string), 64);
		        format(string,sizeof(string), "Stranger", randomID);
		        SetPlayerName(playerid, string);
				SetPlayerAttachedObject(playerid, 5, 18917, 2, 0.078534, 0.041857, -0.001727, 268.970458, 1.533374, 269.223754);
	      		if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "-> %s take and wear his mas.", sendername); }
	      		if(PlayerInfo[playerid][pSex] == 2) { format(string, sizeof(string), "-> %s take and wear her mas.", sendername); }
	      		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
	      		new y, m, d;
				new h,mi,s;
				getdate(y,m,d);
				gettime(h,mi,s);
				format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /mask on",d,m,y,h,mi,s,sendername);
				CommandLog(string);
			}
			else if(strcmp(x_nr,"off",true) == 0)
			{
			    if(PlayerInfo[playerid][pMask] == 0)
		   	 	{
		   		     SendClientMessage(playerid, COLOR_GRAD1, "*!* You don't have a mask, buy one at 24/7.");
		   		     return 1;
		   		}
				for(new i = 0; i < MAX_PLAYERS; i++)
	   			{
	   		    	if(IsPlayerConnected(i))
	   		    	{
			   			ShowPlayerNameTagForPlayer(i, playerid, 1);
					}
				}
				PlayerInfo[playerid][pMaskuse] = 0;
		        SetPlayerName(playerid, OldUsername[playerid]);
				RemovePlayerAttachedObject(playerid, 5);
	      		if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "-> %s take off his mas.", sendername); }
	      		if(PlayerInfo[playerid][pSex] == 2) { format(string, sizeof(string), "-> %s take off her mas.", sendername); }
	      		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
	      		new y, m, d;
				new h,mi,s;
				getdate(y,m,d);
				gettime(h,mi,s);
				format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /mask off",d,m,y,h,mi,s,sendername);
				CommandLog(string);
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)