help me in Unjail command pro scripters
#1

Код:
COMMAND:jail(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 1)
		{
			// Set-up our variables etc
			new PlayerToJail, JailTime, Reason[128], Msg[328], Name[24], jailedBy[24], MsgAll[328];

			if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) 
			{
				// Incorrect params used
				SendClientMessage(playerid, COLOR_ORANGE, "Usage: \"jail <PlayerToJail> <JailTime> <Reason>\"");
			}
			else
			{
				if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
				{
					if(playerData[PlayerToJail][playerLoggedIn])
					{
						if(playerData[playerid][playerLevel] >= playerData[PlayerToJail][playerLevel])
						{
							if(JailTime >= 1)
							{
								// Get the name of the player who jailed the player
								GetPlayerName(playerid, jailedBy, sizeof(jailedBy));
								
								// Get the name of the player who's being sent to jail
								GetPlayerName(PlayerToJail, Name, sizeof(Name));

								for(new p; p < MAX_PLAYERS; p++)
								{
									new pName[24];
									GetPlayerName(p, pName, sizeof(pName));
		
									if(!strcmp(pName, Name))
									{
										// Send the jailed player a message who jailed him, why he's been jailed and how long
										format(Msg, sizeof(Msg), "{A9C4E4}An administrator has jailed you for %i seconds {FE9A2E}[REASON: %s]{FFFFFF}", JailTime, Reason);
										SendClientMessage(p, COLOR_WHITE, Msg);
									}
									else
									{
										format(MsgAll, sizeof(MsgAll), "{A9C4E4}An administrator has sent %s(%i) to jail.", Name, PlayerToJail);
										SendClientMessage(p, COLOR_WHITE, MsgAll);
									}
								}
								
								new aMsg[300];
								for (new i=0; i<MAX_PLAYERS; i++)
								{
									if (playerData[i][playerLevel] >= 1)
									{
										format(aMsg, sizeof(aMsg), "{FE9A2E}[ADMIN] {FFFFFF}%s(%i) has jailed %s(%i) for %i seconds {FE9A2E}[REASON: %s]{FFFFFF}", playerData[playerid][playerNamee], playerid, playerData[PlayerToJail][playerNamee], PlayerToJail, JailTime, Reason);
										SendClientMessage(i, COLOR_WHITE, aMsg);
									}
								}		

								// Call jail function
								sendPlayerJail(PlayerToJail, JailTime, playerid, 0);
								playerData[PlayerToJail][playerAdminJailed] = 1;
								
								ShowPlayerDialog(PlayerToJail, 91827, DIALOG_STYLE_MSGBOX, "Admin Jailed", "You have been sent to jail by an administrator.", "OK", "");	
								
								new log[250];
								format(log, sizeof(log), "%s(%i) has jailed %s(%i) for %i seconds", playerData[playerid][tempAdminName], playerid, Name, PlayerToJail, JailTime);
								SendAdminText(playerid, log);
							}
							else
							{
								SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You cannot use this command on that player.");
							}
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Jail time must be at least 1 second.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
				}
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}

	return 1;
}
Hey,please help me This is Jail command
please make it in unjail please help me pro scripters
Reply
#2

Try it
Код:
COMMAND:unjail(playerid, params[])
{
    if(playerData[playerid][playerLoggedIn])
    {
        if(playerData[playerid][playerLevel] >= 1)
        {
            // Set-up our variables etc
            new PlayerToJail, Reason[128], Msg[328], Name[24], jailedBy[24], MsgAll[328];

            if (sscanf(params, "us[128]", PlayerToJail, Reason)) 
            {
                // Incorrect params used
                SendClientMessage(playerid, COLOR_ORANGE, "Usage: \"unjail <PlayerToJail> <Reason>\"");
            }
            else
            {
                if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
                {
                    if(playerData[PlayerToJail][playerLoggedIn])
                    {
                        if(playerData[playerid][playerLevel] >= playerData[PlayerToJail][playerLevel])
                        {
                            // Get the name of the player who jailed the player
                            GetPlayerName(playerid, jailedBy, sizeof(jailedBy));
                            
                            // Get the name of the player who's being sent to jail
                            GetPlayerName(PlayerToJail, Name, sizeof(Name));

                            for(new p; p < MAX_PLAYERS; p++)
                            {
                                new pName[24];
                                GetPlayerName(p, pName, sizeof(pName));
    
                                if(!strcmp(pName, Name))
                                {
                                    // Send the jailed player a message who jailed him, why he's been jailed and how long
                                    format(Msg, sizeof(Msg), "{A9C4E4}An administrator has unjailed you {FE9A2E}[REASON: %s]{FFFFFF}", Reason);
                                    SendClientMessage(p, COLOR_WHITE, Msg);
                                }
                            }
                          

                            // Call jail function
                            SetPlayerPos(PlayerToJail, X,Y,Z); // Change here, where you want to put the player after you unjail him
                            playerData[PlayerToJail][playerAdminJailed] = 0;
                            
                            ShowPlayerDialog(PlayerToJail, 91827, DIALOG_STYLE_MSGBOX, "Admin Jailed", "You have been unjail by an administrator.", "OK", "");    
                            
                            new log[250];
                            format(log, sizeof(log), "%s(%i) has jailed %s(%i) for %i seconds", playerData[playerid][tempAdminName], playerid, Name, PlayerToJail, JailTime);
                            SendAdminText(playerid, log);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Jail time must be at least 1 second.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
                }
            }
        }
        else
        {
            return 0;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
    }

    return 1;
}
I make it so fast i can, i don't test it, tell me if you got a problem with the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)