[Ajuda]Ligando Comandos
#1

Galera tф com uma pequena dъvida, queria saber como faзo para ligar o comando /prender com /presos, como assim?
Quando eu prender o cara por tantos segundos apareзer assim no /presos NomedoJogar [Segundos] eu jб tenho o comando ele apareзe o nome e tudo sу que apareзe 0 Segundos, como faзo pra ligar estes comandos ?

Comando /prender
Код:
        if(strcmp(cmd, "/prender", true) == 0)
        {
                new tmpp[256];
				new playername;
                tmp = strtok(cmdtext, idx);
                tmpp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                        SendClientMessage(playerid, COLOR_GREEN, "Uso correto: /prender [id do player] [segundos");
                        return 1;
                }
                giveplayerid = strval(tmp);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                new Second = strval(tmpp);
                if(logado[playerid] == 1)
                {
                    if(PlayerInfo[playerid][GAT] >= 2)
                    {
                                format(string, sizeof(string), "O Oficial %s prendeu o jogador %s por %d segundo(s)", sendername,giveplayer,Second);
                                SendClientMessageToAll(COLOR_YELLOW, string);
                                SendClientMessage(playerid, COLOR_YELLOW, string);
                                format(string, sizeof(string), "~g~Preso por: ~n~~r~%s.", sendername);
                                GameTextForPlayer(giveplayerid, string, 1000, 1);
                                SetPlayerInterior(giveplayerid, 6);
                                SetPlayerPos(giveplayerid, 264.6288,77.5742,1001.0391);
                                SetPlayerArmour(giveplayerid, 0);
                                TogglePlayerControllable(giveplayerid, 1);
                                ResetPlayerWeapons(giveplayerid);
                                SetTimerEx("Unjail", Second*1000, 0, "i", giveplayerid);
								format(file,sizeof(file),"%s.ini",playername);
								dini_Create(file);
								dini_IntSet(file,"Preso", 1);
								PlayerInfo[giveplayerid][Preso] = dini_Int(file,"Preso");
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_CYAN, "Vocк nгo й um Membro do GAT !");
                        }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_CYAN, "Vocк tem que estar logado para usar este comando!");
                }
                return 1;
        }
Comando /presos
Код:
        if(!strcmp(cmdtext, "/presos", true))
        {
            SendClientMessage(playerid, 0x33AAFFFF, "** Todos os PRESOS Online **");
                new count=0;
				new tmpp[256];
                tmp = strtok(cmdtext, idx);
                tmpp = strtok(cmdtext, idx);
                new Second = strval(tmpp);
                for(new i=0; i<MAX_PLAYERS; i++)
                {
                if(IsPlayerConnected(i))
                {
                    if(logado[i] == 1)
                    {
                                        if(PlayerInfo[i][Preso] >= 1)
                                        {
                                                new str[256];
                                                new pname[24];
												GetPlayerName(i, pname, 24);
                                                format(str, 256, "PRESO - %s - [%d Segundos] ", pname, Second);
                                                SendClientMessage(playerid, 0xC0C0C0FF, str);
		                                        count++;
                                        }
                                }
                        }
                }
                if(count == 0)
                {
                SendClientMessage(playerid, COLOR_CYAN, "Nenhum PRESO online !");
                }
                return 1;
        }
Reply
#2

Olб Nake01.


Comeзo do mode:
pawn Код:
new SecondsJailed[MAX_PLAYERS];
pawn Код:
if(strcmp(cmd, "/prender", true) == 0)
        {
                new tmpp[256];
                new playername;
                tmp = strtok(cmdtext, idx);
                tmpp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                        SendClientMessage(playerid, COLOR_GREEN, "Uso correto: /prender [id do player] [segundos");
                        return 1;
                }
                giveplayerid = strval(tmp);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                new Second = strval(tmpp);
                if(logado[playerid] == 1)
                {
                    if(PlayerInfo[playerid][GAT] >= 2)
                    {
                                SecondsJailed[playerid] = Second;
                                format(string, sizeof(string), "O Oficial %s prendeu o jogador %s por %d segundo(s)", sendername,giveplayer,Second);
                                SendClientMessageToAll(COLOR_YELLOW, string);
                                SendClientMessage(playerid, COLOR_YELLOW, string);
                                format(string, sizeof(string), "~g~Preso por: ~n~~r~%s.", sendername);
                                GameTextForPlayer(giveplayerid, string, 1000, 1);
                                SetPlayerInterior(giveplayerid, 6);
                                SetPlayerPos(giveplayerid, 264.6288,77.5742,1001.0391);
                                SetPlayerArmour(giveplayerid, 0);
                                TogglePlayerControllable(giveplayerid, 1);
                                ResetPlayerWeapons(giveplayerid);
                                SetTimerEx("Unjail", Second*1000, 0, "i", giveplayerid);
                                format(file,sizeof(file),"%s.ini",playername);
                                dini_Create(file);
                                dini_IntSet(file,"Preso", 1);
                                PlayerInfo[giveplayerid][Preso] = dini_Int(file,"Preso");
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_CYAN, "Vocк nгo й um Membro do GAT !");
                        }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_CYAN, "Vocк tem que estar logado para usar este comando!");
                }
                return 1;
        }


E o outro comando:


pawn Код:
if(!strcmp(cmdtext, "/presos", true))
        {
            SendClientMessage(playerid, 0x33AAFFFF, "** Todos os PRESOS Online **");
                new count=0;
                new tmpp[256];
                tmp = strtok(cmdtext, idx);
                tmpp = strtok(cmdtext, idx);
                new Second = strval(tmpp);
                for(new i=0; i<MAX_PLAYERS; i++)
                {
                if(IsPlayerConnected(i))
                {
                    if(logado[i] == 1)
                    {
                                        if(PlayerInfo[i][Preso] >= 1)
                                        {
                                                new str[256];
                                                new pname[24];
                                                GetPlayerName(i, pname, 24);
                                                format(str, 256, "PRESO - %s - [%d Segundos] ", pname, SecondsJailed[playerid]);
                                                SendClientMessage(playerid, 0xC0C0C0FF, str);
                                                count++;
                                        }
                                }
                        }
                }
                if(count == 0)
                {
                SendClientMessage(playerid, COLOR_CYAN, "Nenhum PRESO online !");
                }
                return 1;
        }


Atenciosamente,
Falcon.
Reply
#3

Foi sim, estб aparecendo o segundo que botei sу que gostaria que aparecese assim eu botei 50 segundos ai se eu isse digitando /presos os segundos dali ia diminuindo... Understand ?
Reply
#4

Olб Nake01.


Vб na sua public Unjail e adicione isto:

pawn Код:
SecondsJailed[playerid] --;

Atenciosamente,
Falcon.
Reply
#5

desse jeito ai ? ^o)
Reply
#6

aahh agora que vim entender oque vocк realmente quer...


substitua o comando prender por este:

PHP код:
if(strcmp(cmd"/prender"true) == 0)
        {
                new 
tmpp[256];
                new 
playername;
                
tmp strtok(cmdtextidx);
                
tmpp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                        
SendClientMessage(playeridCOLOR_GREEN"Uso correto: /prender [id do player] [segundos");
                        return 
1;
                }
                
giveplayerid strval(tmp);
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                new 
Second strval(tmpp);
                if(
logado[playerid] == 1)
                {
                    if(
PlayerInfo[playerid][GAT] >= 2)
                    {
                                
SecondsJailed[playerid] = Second;
                                
SetTimerEx("DiminSecondsJailed"1000false"i"playerid);
                                
format(stringsizeof(string), "O Oficial %s prendeu o jogador %s por %d segundo(s)"sendername,giveplayer,Second);
                                
SendClientMessageToAll(COLOR_YELLOWstring);
                                
SendClientMessage(playeridCOLOR_YELLOWstring);
                                
format(stringsizeof(string), "~g~Preso por: ~n~~r~%s."sendername);
                                
GameTextForPlayer(giveplayeridstring10001);
                                
SetPlayerInterior(giveplayerid6);
                                
SetPlayerPos(giveplayerid264.6288,77.5742,1001.0391);
                                
SetPlayerArmour(giveplayerid0);
                                
TogglePlayerControllable(giveplayerid1);
                                
ResetPlayerWeapons(giveplayerid);
                                
SetTimerEx("Unjail"Second*10000"i"giveplayerid);
                                
format(file,sizeof(file),"%s.ini",playername);
                                
dini_Create(file);
                                
dini_IntSet(file,"Preso"1);
                                
PlayerInfo[giveplayerid][Preso] = dini_Int(file,"Preso");
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_CYAN"Vocк nгo й um Membro do GAT !");
                        }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_CYAN"Vocк tem que estar logado para usar este comando!");
                }
                return 
1;
        } 
o comando presos use como o que eu postei acima...


e adicione isto ao seu gamemode:

PHP код:
forward DiminSecondsJailed(playerid);
public 
DiminSecondsJailed(playerid)
{
    if(
SecondsJailed[playerid] > 0)
    {
        
SecondsJailed[playerid] --;
        
SetTimerEx("DiminSecondsJailed"1000false"i"playerid);
    }
    return 
1;

Atenciosamente,
Falcon.
Reply
#7

Funciono agora como faзo pra quando o player estiver com segundos de presos ele volta pra cadeia por ex: se ele der /kill ou sair do servidor (:
Reply
#8

Eu fiz isso no meu servidor.

pawn Код:
public jailUpdate()
{
    foreach(Player, i)
    {
        if( GetPVarInt( i , "Logado" ) && GetPVarInt( i , "AjailSpawn" ) )
        {
            if( playerInfo[i][pJailTime] > 0 && GetPVarInt( i , "NaCadeia" ) == 0 )
            {
                if( playerInfo[i][pJailType] == JAIL_TYPE_ADMINJAIL )
                {
                    SetPlayerPos( i , 2689.0600585938, 2689.1748046875, 22.947216033936 );
                    // MinX: 2681.7111816406 MinY: 2678.3391113281 MaxX: 2703.8754882813 MaxY: 2715.3835449219
                    SetPlayerWorldBounds( i, 2703.8706,2681.6860,2715.3713,2678.0242 );
                    GameTextForPlayer( i, "~w~Bem-vindo a ~r~ajail", 3000, 1 );
                    SetPVarInt( i , "NaCadeia", 1 );
                }

                if( playerInfo[i][pJailType] == JAIL_TYPE_PD_JAIL )
                {
                    new r = random(sizeof pd_Jail_Pos);
                    SetPlayerInterior( i, 5 );
                    SetPlayerVirtualWorld( i, 0 );
                    SetPlayerPos( i, pd_Jail_Pos[r][0],pd_Jail_Pos[r][1],pd_Jail_Pos[r][2] );
                    freezePlayer( i );
                    GameTextForPlayer( i, "~w~Bem-vindo a ~b~prisao", 3000, 1 );
                    SetPVarInt( i , "NaCadeia", 1 );
                }
                if( playerInfo[i][pJailType] == JAIL_TYPE_PD_JAIL_MAXIMA )
                {
                    SetPlayerInterior( i, 5 );
                    SetPlayerVirtualWorld( i, 0 );
                    SetPlayerPos( i, 1790.0048,-1566.4819,2034.3627 );
                    freezePlayer( i );
                    GameTextForPlayer( i, "~w~Bem-vindo a ~b~prisao", 3000, 1 );
                    SetPVarInt( i , "NaCadeia", 1 );
                }
            }
            if( playerInfo[i][pJailTime] <= 0 && GetPVarInt( i , "NaCadeia" ) == 1 )
            {
                playerSpawn( i );
                SetPlayerInterior( i, 0 );
                SetPVarInt( i , "NaCadeia", 0 );
                SetPlayerWorldBounds( i, 20000.0, -20000.0, 20000.0, -20000.0  );
                GameTextForPlayer( i, "Voce esta livre!", 3000, 1 );
                SendClientMessage( i , -1, "Vocк estб livre denovo! Tente ser um cidadгo melhor" );

            }
            if( GetPVarInt( i , "NaCadeia" ) == 1 )
            {
                playerInfo[i][pJailTime]--;
            }
        }
        SetPlayerSkillLevel(i, WEAPONSKILL_PISTOL, 1);
        SetPlayerSkillLevel(i, WEAPONSKILL_PISTOL_SILENCED, 1);
        SetPlayerSkillLevel(i, WEAPONSKILL_DESERT_EAGLE, 999);
        SetPlayerSkillLevel(i, WEAPONSKILL_SHOTGUN, 999);
        SetPlayerSkillLevel(i, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
        SetPlayerSkillLevel(i, WEAPONSKILL_SPAS12_SHOTGUN, 999);
        SetPlayerSkillLevel(i, WEAPONSKILL_MICRO_UZI, 1);
        SetPlayerSkillLevel(i, WEAPONSKILL_MP5, 999);
        SetPlayerSkillLevel(i, WEAPONSKILL_AK47, 999);
        SetPlayerSkillLevel(i, WEAPONSKILL_M4, 999);
        SetPlayerSkillLevel(i, WEAPONSKILL_SNIPERRIFLE, 999);
    }
    return 1;
}
Reply
#9

Miki usa qual sistema de leitura/salvamento ? :B
Reply
#10

MySQL.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)