Need help for command /arrest /ajail
#1

Okey hello guys I need your help please post me it how to fix Diz' )

Time doesn't down please help me )


It's mine Arrest CMD and Ajail
Код:
    if(strcmp(cmd, "/arrest", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2|| PlayerInfo[playerid][pMember] == 14)
			{
				if(PlayerToPoint(6.0, playerid, 418.2874,-1510.6937,615.7189) || PlayerToPoint(15.0, playerid,198.1660,177.6201,1003.0234) || PlayerToPoint(15.0, playerid,268.214019, 77.829612, 1001.039062))
				{

					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
						return 1;
					}
					moneys = strval(tmp);
					if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Jail Price can't be below $1 or above $99999!"); return 1; }
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
						return 1;
					}
					new time = strval(tmp);
					if(time < 1 || time > 60) { SendClientMessage(playerid, COLOR_GREY, "   Jail Time Minutes can't be below 1 or above 60 minutes!"); return 1; }
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
						return 1;
					}
					new bail = strval(tmp);
					if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "   Jail Bailing can't be below 0 or above 1!"); return 1; }
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
						return 1;
					}
					new bailprice = strval(tmp);
					if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "   Jail Bailing can't be below $0 or above $3000000!"); return 1; }
					new suspect = GetClosestPlayer(playerid);
					if(IsPlayerConnected(suspect))
					{
						if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
						{
							GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							GiveNameSpace(sendername);
							GiveNameSpace(giveplayer);
							if(WantedLevel[suspect] < 1 && !PlayerInfo[suspect][pWarrant])
							{
						    	SendClientMessage(playerid, COLOR_GREY, "   Player must be at least Wanted Level 1!");
						    	return 1;
							}
							format(string, sizeof(string), "* %s opens the jail and pushes the suspect in it", sendername);
						    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						    format(string, sizeof(string), "* %s takes out keys, closes jail and locks it", sendername);
						    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							format(string, sizeof(string), "* You arrested %s!", giveplayer);
							SendClientMessage(playerid, COLOR_WHITE, string);
							GivePlayerPCash(suspect, -moneys);
							format(string, sizeof(string), "arrested by %s ~n~    for $%d", sendername, moneys);
							GameTextForPlayer(suspect, string, 5000, 5);
							ResetPlayerWeaponsEx(suspect);
							PlayerInfo[suspect][pInvWeapon] = 0;
	                        PlayerInfo[suspect][pInvAmmo] = 0;
	                        PlayerInfo[suspect][pWarrant]=0;
							if(PlayerInfo[playerid][pMember]==1)
							{
								format(string, sizeof(string), "[News] Officer %s has just arrested %s", sendername, giveplayer);
								BroadCast(COLOR_BLUE, string);
								SetPlayerPos(suspect,227.2460,109.7719,999.0156);
							}
                            else if(PlayerInfo[playerid][pMember]==2)
							{
								format(string, sizeof(string), "[News] Agent %s has just arrested %s", sendername, giveplayer);
								BroadCast(COLOR_BLUE, string);
								SetPlayerPos(suspect,197.6586,175.2065,1003.0234);
							}
                        	   else if(PlayerInfo[playerid][pMember]==14)
							{
								format(string, sizeof(string), "[News] Sheriff %s has just arrested %s", sendername, giveplayer);
								BroadCast(COLOR_BLUE, string);
								SetPlayerPos(suspect,263.889678,77.249244,1001.039062);
							}
							PlayerInfo[suspect][pJailTime] = time*60;
							format(string,sizeof(string),"%s arrests %s for %d mins, %d bail",sendername,giveplayer,PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
							CopLog(string);
							if(bail == 1)
							{
								JailPrice[suspect] = bailprice;
								format(string, sizeof(string), "You are jailed for %d minutes.   Bail: $%d", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
								SendClientMessage(suspect, COLOR_WHITE, string);
							}
							else
							{
							    JailPrice[suspect] = 0;
								format(string, sizeof(string), "You are jailed for %d minutes.   Bail: Unable", PlayerInfo[suspect][pJailTime]);
								SendClientMessage(suspect, COLOR_WHITE, string);
							}
							OnPlayerDataSave(suspect);
							PlayerInfo[suspect][pJailed] = 1;
							WantedLevel[suspect] = 0;
							WantLawyer[suspect] = 1;
							PlayerInfo[suspect][pArrested] += 1;
						}
					}
					else
					{
				    	SendClientMessage(playerid, COLOR_GREY, "   No-one close enough to arrest.");
				    	return 1;
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   your not in the jail spot.");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop/FBI !");
			    return 1;
			}
		}
		return 1;
	}
Код:
	if(strcmp(cmd, "/ajail", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
				        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						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_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
							return 1;
						}
						format(string, sizeof(string), "* You Jailed %s.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTRED, string);
						format(string, sizeof(string), "* You were Jailed by Admin %s.", sendername);
						SendClientMessage(playa, COLOR_LIGHTRED, string);
						PlayerInfo[playa][pJailed] = 1;
						PlayerInfo[playa][pJailTime] = money*60;
						SetPlayerInterior(playa, 10);
						PlayerInfo[playa][pInt] = 10;
						SetPlayerPos(playa, 215.6734,110.1341,999.0156);
						format(string, sizeof(string), "You are jailed for %d minutes.   Bail: Unable", money);
						SendClientMessage(playa, COLOR_WHITE, string);
						format(string, 256, "AdmCmd: %s has been jailed by Admin %s [Reason: %s]", giveplayer, sendername, (result));
						BroadCast(COLOR_LIGHTRED,string);
						format(string, sizeof(string), "AdmCmd: %s has been Admin-jailed by %s [Reason: %s]", giveplayer, sendername, (result));
						printf("%s",string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply
#2

Use ZCMD + sscanf = A lot easier.
Reply
#3

what you mean can you give me Tut for that? or somthing like that
Reply
#4

This is link to download ZCMD - here you can find all what you need about ZCMD.
This is link to download sscanf - here you can find all what you need about sscanf.
Reply
#5

Thought you need to learn it and use a few hours of your life (no more than 8 ) to convert all commands, uhh yea.
Reply
#6

thanks )0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)