Need help with /jail
#1

Hereґs the /jail command Im using currently:

Код:
	if(strcmp(cmd, "/jail", true) == 0) // Jails a player
	{
		if (AccountInfo[playerid][AdminLevel] >= 2)
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
				return 1;
			}
			new targetid = ReturnUser(tmp);
			if(IsPlayerConnected(targetid))
			{
				if(targetid != INVALID_PLAYER_ID)
				{
					if(AccountInfo[giveplayerid][Jail] == 0)
					{
						GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new reason[128];
						reason = bigstrtok(cmdtext, idx);
						if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
						format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
						SendClientMessage(targetid, ADMIN_RED, string);
						format(string, sizeof(string), "-| Administrator %s jailed %s. [ Reason: %s ] |-",sendername,giveplayername, reason);
						SendClientMessageToAll(ADMIN_RED,string);
						AccountInfo[targetid][Jail] = 1;
						OnPlayerJailed(targetid);
						return 1;
					}
					else SendClientMessage(playerid, RED, "Player is already jailed!");
				}
				else
				{
					format(string, sizeof(string), "%d is not an active player.", targetid);
					SendClientMessage(playerid, RED, string);
				}
			}
			else
			{
				format(string, sizeof(string), "%d is not an active player.", targetid);
				SendClientMessage(playerid, RED, string);
			}
		}
		else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
		return 1;
	}
Gud, but you cant enter a time here. How to add the time in minutes then? Example /jail 1 5 DMing
1 = ID, 5 = minutes, DMing = reason
Reply
#2

Quote:
Originally Posted by Mo3
Hereґs the /jail command Im using currently:

Код:
	if(strcmp(cmd, "/jail", true) == 0) // Jails a player
	{
		if (AccountInfo[playerid][AdminLevel] >= 2)
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
				return 1;
			}
			new targetid = ReturnUser(tmp);
			if(IsPlayerConnected(targetid))
			{
				if(targetid != INVALID_PLAYER_ID)
				{
					if(AccountInfo[giveplayerid][Jail] == 0)
					{
						GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new reason[128];
						reason = bigstrtok(cmdtext, idx);
						if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
						format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
						SendClientMessage(targetid, ADMIN_RED, string);
						format(string, sizeof(string), "-| Administrator %s jailed %s. [ Reason: %s ] |-",sendername,giveplayername, reason);
						SendClientMessageToAll(ADMIN_RED,string);
						AccountInfo[targetid][Jail] = 1;
						OnPlayerJailed(targetid);
						return 1;
					}
					else SendClientMessage(playerid, RED, "Player is already jailed!");
				}
				else
				{
					format(string, sizeof(string), "%d is not an active player.", targetid);
					SendClientMessage(playerid, RED, string);
				}
			}
			else
			{
				format(string, sizeof(string), "%d is not an active player.", targetid);
				SendClientMessage(playerid, RED, string);
			}
		}
		else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
		return 1;
	}
Gud, but you cant enter a time here. How to add the time in minutes then? Example /jail 1 5 DMing
1 = ID, 5 = minutes, DMing = reason
i dont kno how to at the moment(means i just dunno it right now but if id think of it) id have to think of it
but as much as u ask around here on thee forums
i have to tell u to please read
the samp wiki
it helps much at scripting.
if u got problems please research atleast 30mins there before u come here.
other ppls need help here too.

https://sampwiki.blast.hk/wiki/Main_Page <<samp wiki
Reply
#3

Itґs nice that youґre careing about my scripts, but Iґve already done research on this command and my timers wont work, thats why I ask here.
Reply
#4

Quote:
Originally Posted by Mo3
Itґs nice that youґre careing about my scripts, but Iґve already done research on this command and my timers wont work, thats why I ask here.
well u could read the cmd.
then ud see that theres sumin in it that says idx or strtok
or tmp which equals the giveplayerid

so if ud be clever urself u could goto samp wiki n research this tags there.

then ud find:

https://sampwiki.blast.hk/wiki/Tutorial_of_strtok

https://sampwiki.blast.hk/wiki/Strtok

just try to research the stuffu wanna change man
guess that shouldnt be a problem man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)