[Ajuda] Como criar um comando /Prender [ID] [Minutos] [Motivo] para Admin
#1

Galera como eu crio um comando de prender, de minutos... EX 300Mins... alguem me ajuda? pf
Reply
#2

Tente Esse

PHP код:
dcmd_prender(playerid,params[]) {
    if(
PlayerInfo[playerid][LoggedIn] == 1) {
        if(
PlayerInfo[playerid][Level] >= 4) {
            new 
tmp[256], tmp2[256], tmp3[256], Indextmp strtok(params,Index), tmp2 strtok(params,Index), tmp3 strtok(params,Index);
            if(!
strlen(params)) return SendClientMessage(playeridred"USO: /jail [playerid] [minutos] [motivo]");
            new 
player1playername[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(player1playernamesizeof(playername)); GetPlayerName(playeridadminnamesizeof(adminname));
                    new 
jtime strval(tmp2);
                    if(
jtime == 0jtime 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),"Administrador %s prendeu %s ",adminnameplayername);
                        else 
format(string,sizeof(string),"Administrador %s prendeu %s [motivo: %s]",adminnameplayernameparams[strlen(tmp)+1] );
                       } else {
                        if(!
strlen(tmp3)) format(string,sizeof(string),"Administrador %s prendeu %s por %d minutos",adminnameplayernamejtime);
                        else 
format(string,sizeof(string),"Administrador %s prendeu %s por %d minutos [motivo: %s]",adminnameplayernamejtimeparams[strlen(tmp2)+strlen(tmp)+1] );
                    }
                    return 
SendClientMessageToAll(blue,string);
                } else return 
SendClientMessage(playeridred"O jogador jб estб na cadeia");
            } else return 
SendClientMessage(playeridred"Jogador nгo conectado ou й um admin com nнvel alto");
        } else return 
SendClientMessage(playerid,red,"ERRO: Vocк nгo tem nнvel alto suficiente para usar este comando");
    } else return 
SendClientMessage(playerid,red,"ERRO: Vocк deve estar logado para usar este comando");

Reply
#3

Vк se esse server pra vocк
pawn Код:
COMMAND:prender(playerid, params[])
{
    new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/prender", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] >= 2)
        {
            if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Use: /prender [id] [tempo] [motivo]");
            else
                if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
                {
                    // Jail the player
                    Police_JailPlayer(PlayerToJail, JailTime);
                    // Get the name of the player who jailed the player
                    GetPlayerName(playerid, AdminName, sizeof(AdminName));
                    // Get the name of the player who's being sent to jail
                    GetPlayerName(PlayerToJail, Name, sizeof(Name));
                    // Send the jailed player a message who jailed him, why he's been jailed and how long
                    format(Msg, 128, "Vocк foi preso por %s %s por %i segundos.", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
                    format(Msg, 128, "Motivo: %s", Reason);
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
                    format(Msg, 128, "{00FF00}Vocк prendeu {FFFF00}%s{00FF00} por {FFFF00}%i{00FF00} segundos.", Name, JailTime);
                    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                }
                else
                    SendClientMessage(playerid, 0xFF0000FF, "Esse jogador nгo estб online.");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply
#4

Consegui ñ
Reply
#5

Claro que nгo conseguiu, eles sу passaram o comando, e as variбveis? Tem que ter o cуdigo completo.
Reply
#6

Dar Ctrl + C no GM pronto e depois Ctrl + V nгo ajuda nй!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)