Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

Posted

Am comanda de jail

dcmd_jail(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 3) {
		    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /jail [playerid] [minutes] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				if(PlayerInfo[player1][Jailed] == 0) {
					GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
					new jtime = strval(tmp2);
					if(jtime == 0) jtime = 9999;

			       	CMDMessageToAdmins(playerid,"JAIL");
					PlayerInfo[player1][JailTime] = jtime*1000*60;
    			    SetTimerEx("JailPlayer",5000,0,"d",player1);
		    	    SetTimerEx("Jail1",1000,0,"d",player1);
		        	PlayerInfo[player1][Jailed] = 1;

					if(jtime == 9999) {
						if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"Administrator %s has jailed %s ",adminname, playername);
						else format(string,sizeof(string),"Administrator %s has jailed %s [reason: %s]",adminname, playername, params[strlen(tmp)+1] );
   					} else {
						if(!strlen(tmp3)) format(string,sizeof(string),"Administrator %s has jailed %s for %d minutes",adminname, playername, jtime);
						else format(string,sizeof(string),"Administrator %s has jailed %s for %d minutes [reason: %s]",adminname, playername, jtime, params[strlen(tmp2)+strlen(tmp)+1] );
					}
	    			return SendClientMessageToAll(blue,string);
				} else return SendClientMessage(playerid, red, "Player is already in jail");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

Vreu sa fac ca cind esti in jail sa nu poti nici o comadna chiar daca esti admin ma puteti ajuta sa o fac

lol

1 answer to this question

Recommended Posts

Posted

Adauga deaspura primei comenzi din script, dupa public OnPlayerCommandText(playerid, cmdtext[])

if(PlayerInfo[player1][Jailed] == 1) 
{
    //restu de liniie (comenzile)
Iar dupa ultima comanda pui
} else return SendClientMessage(playerid, red, "Player is already in jail");
Exemplu:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //chestiile cu new daca ai.
    if(PlayerInfo[player1][Jailed] == 1)
    {
        if (strcmp(cmdtext, "/primacomanda", true) == 0)
        {
            SetPlayerPos(playerid,X,Y,Z);
            return 1;
        }
        else return SendClientMessage(playerid, red, "Player is already in jail");
        return 1;
    }
    return 0;
}

Ceva de genul. Am scris-o repede ca ma grabeam si nu m-am uitat daca sunt greseli.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.