HELP [ + REP ]
#1

Код:
	if(strcmp(cmd,"/register",true) == 0)
	{
    	new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
		idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
		result[idx - offset] = cmdtext[idx];
		idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result))
		{
		SendClientMessage(playerid, COLOR_WHITE, "( ! ) USAGE: /register (password)");
		return 1;
		}
		if (Logged[playerid] == 1) return scm(playerid,c_r,"( ! ) Already Logged in !");
		if (udb_Exists(PlayerName(playerid))) return scm(playerid,c_r,"( ! ) Account already exists, please use '/login password'.");
		new plrip[256];
		GetPlayerIp(playerid,plrip,sizeof(plrip));
		if (udb_Create(PlayerName(playerid),result))
		{
 			SystemMsg(playerid,"( ! ) Account successfully created. Login with '/login password' now.");
			RemoveJob(playerid);
		 	SetJob(playerid,9);
			ResetPlayerACash(playerid);
			GivePlayerTec9(playerid,-GetPlayerTec9(playerid));
			GivePlayerTec9B(playerid,-GetPlayerTec9B(playerid));
			GivePlayerACash(playerid, 25);
			ResetPlayerAdminz(playerid);
			SavePlayer(playerid);
			clan = 255;
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd,"/login",true) == 0)
	{
    	new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
		idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
		result[idx - offset] = cmdtext[idx];
		idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result))
		{
		SendClientMessage(playerid, COLOR_WHITE, "( ! ) USAGE: /register (password)");
		return 1;
		}
		if (Logged[playerid]) return SystemMsg(playerid,"( ! ) Already Logged in !");
		if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"( ! ) Account doesn't exist, please use '/register password'.");
    	if (strlen(result)==0) return SystemMsg(playerid,"( ! ) USAGE: /login (password)");
    	if(udb_CheckLogin(PlayerName(playerid),result))
		{
       		new plrip[256];
   	   		GetPlayerIp(playerid,plrip,256);
       		GivePlayerMoney(playerid,udb_UserInt(PlayerName(playerid),"Money")-GetPlayerMoney(playerid));
       		GivePlayerACash(playerid,udb_UserInt(PlayerName(playerid),"ACash")-GetPlayerACash(playerid));
       		GivePlayerAdminz(playerid,udb_UserInt(PlayerName(playerid),"Admin")-GetPlayerAdminz(playerid));
	       	SetJob(playerid,udb_UserInt(PlayerName(playerid),"Job")-GetPlayerJobID(playerid));
       		GivePlayerMute(playerid,udb_UserInt(PlayerName(playerid),"Muted")-GetPlayerMute(playerid));
	   		GivePlayerMineral(playerid,udb_UserInt(PlayerName(playerid),"Mineral")-GetPlayerMineral(playerid));
	   		GivePlayerM4(playerid,udb_UserInt(PlayerName(playerid),"M4")-GetPlayerM4(playerid));
	   		GivePlayerAK(playerid,udb_UserInt(PlayerName(playerid),"AK47")-GetPlayerAK(playerid));
	   		GivePlayerSG(playerid,udb_UserInt(PlayerName(playerid),"Shotgun")-GetPlayerSG(playerid));
	   		GivePlayerSSG(playerid,udb_UserInt(PlayerName(playerid),"Sawn-off shotgun")-GetPlayerSSG(playerid));
	   		GivePlayerSMG(playerid,udb_UserInt(PlayerName(playerid),"SMG")-GetPlayerSMG(playerid));
	   		GivePlayerSniper(playerid,udb_UserInt(PlayerName(playerid),"Sniper")-GetPlayerSniper(playerid));
	   		GivePlayerDeagle(playerid,udb_UserInt(PlayerName(playerid),"Deagle")-GetPlayerDeagle(playerid));
		   	GivePlayerSDpistol(playerid,udb_UserInt(PlayerName(playerid),"SDpistol")-GetPlayerSDpistol(playerid));
		   	GivePlayerTec9(playerid,udb_UserInt(PlayerName(playerid),"Tec9")-GetPlayerTec9(playerid));
	   		GivePlayerM4B(playerid,udb_UserInt(PlayerName(playerid),"M4B")-GetPlayerM4B(playerid));
	   		GivePlayerAKB(playerid,udb_UserInt(PlayerName(playerid),"AK47B")-GetPlayerAKB(playerid));
	   		GivePlayerSGB(playerid,udb_UserInt(PlayerName(playerid),"ShotgunB")-GetPlayerSGB(playerid));
	   		GivePlayerSSGB(playerid,udb_UserInt(PlayerName(playerid),"Sawn-off shotgunB")-GetPlayerSSGB(playerid));
	   		GivePlayerSMGB(playerid,udb_UserInt(PlayerName(playerid),"SMGB")-GetPlayerSMG(playerid));
	   		GivePlayerSniperB(playerid,udb_UserInt(PlayerName(playerid),"SniperB")-GetPlayerSniperB(playerid));
	   		GivePlayerDeagleB(playerid,udb_UserInt(PlayerName(playerid),"DeagleB")-GetPlayerDeagleB(playerid));
	   		GivePlayerSDpistolB(playerid,udb_UserInt(PlayerName(playerid),"SDpistolB")-GetPlayerSDpistolB(playerid));
	   		GivePlayerTec9B(playerid,udb_UserInt(PlayerName(playerid),"Tec9B")-GetPlayerTec9B(playerid));
	   		GivePlayerHit(playerid,udb_UserInt(PlayerName(playerid),"Hit")-GetPlayerHit(playerid));
	   		GivePlayerMlvl(playerid,udb_UserInt(PlayerName(playerid),"Mining level")-GetPlayerMlvl(playerid));
	   		GivePlayerPizza(playerid,udb_UserInt(PlayerName(playerid),"Pizzas")-GetPlayerPizza(playerid));
	   		GivePlayerCP(playerid,udb_UserInt(PlayerName(playerid),"CP")-GetPlayerCP(playerid));
	   		GivePlayerWlic(playerid,udb_UserInt(PlayerName(playerid),"Wlic")-GetPlayerWlic(playerid));
   	   		udb_UserSet(PlayerName(playerid),"IP",plrip);
   	   		udb_UserSet(PlayerName(playerid),"name",PlayerName(playerid));
   	   		clan = 255;
	   		OnPlayerLogin(playerid);
       		Logged[playerid]=true;
			SendClientMessage(playerid,COLOR_GREEN,"( ! ) Access granted ! You're now logged in !");
			return 1;
    	}
    	return 1;
	}
   	if(Logged[playerid] == 0 && strmatch(cmdtext,"register") == 0 && strmatch(cmdtext,"login") == 0)
	{
	    SendClientMessage(playerid,c_r,"( ! ) You cannot use commands, you are not logged in !");
	    return 0;
	}
   	if(ShitInfo[playerid][pMuted] == 1 && GetPlayerAdminz(playerid) < 1)
	{
	    if(!IsPlayerAdmin(playerid))
	    {
	    SendClientMessage(playerid,c_r,"( ! ) You cannot use commands, you are muted !");
	    return 0;
	    }
	return 0;
	}
   	if(ShitInfo[playerid][pJailed] == 1 && GetPlayerAdminz(playerid) < 1)
	{
 		if(!IsPlayerAdmin(playerid))
	    {
	    SendClientMessage(playerid,c_r,"( ! ) You cannot use commands, you are in jail !");
	    return 0;
	    }
	return 0;
	}
I wanna move them to Dialogs.
Reply
#2

Use Filterscripts
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)