[Ajuda] Comando /prender prendendo por segundos e nгo minutos
#1

Eaн, tranquilo?! Enfim, estou codando um game-mode porйm deu um certo bug no /prender.. Ao efetuar, ele prende certinho, spawna e tal mas na hora do tempo de ficar preso, ele fica por segundos.. Ou seja, eu dф /prender [id] 100 e ao invйs de ele ficar 100 minutos, ele vai ficar 100 segundos. Se alguйm puder me ajudar, agradeзo.

Код:
COMMAND:prisao(playerid, params[])
{
	  new timefixfix = timefix 60*60;
	new targetid,timefix,string[128],price,sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
	if(sscanf(params, "uiii", targetid, timefix,price)) SendClientMessage(playerid, COLOR_LIGHTRED, "USE: /prisao [id] [tempo(minutos)] [fianзa($2000-$80000)-($0 Nenhuma)]");
	else
	{
	    if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "Vocк deve estar logado para utilizar este comando.");
        if (PlayerInfo[playerid][pdSuspensionDay] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк estб atualmente suspenso da LSPD!");
//		if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode prender vocк mesmo.");
	    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Este jogador nгo estб conectado !");
		if(timefix < 1 || timefix > 3000) return SendClientMessage(playerid, COLOR_GREY, "O tempo nгo pode ser menor que 1 ou maior que 3000.");
		if(price != 0)
		{
		    if(price < 2000 || price > 80000) return SendClientMessage(playerid, COLOR_GREY, "A fianзa nгo pode ser menos que 2000 ou maior que 80000.");
		}
		if(GetPVarInt(playerid, "Member") == 6 || GetPVarInt(playerid, "Member") == 7)
		{
			if(PlayerToPlayer(playerid,targetid,5.0))
			{
			    if(IsPlayerInRangeOfPoint(playerid,10.0,321.9542,314.4457,999.1484))
			    {
						    new timefixfix = timefix 60*60;
//				    if(GetPVarInt(targetid, "Strikes") >= 3) timefixfix = 999999999, SetPVarInt(targetid, "Changes", GetPVarInt(targetid, "Changes")+1);
   			        format(sendername, sizeof(sendername), "%s", PlayerName(playerid)), format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));
      		        GiveNameSpace(sendername), GiveNameSpace(giveplayer);
        	        format(string, sizeof(string), "[Prisгo]: O oficial %s prendeu %s na San Andreas High Facility Prison.", sendername, giveplayer);
		            SendFactionMessage(7,COLOR_RED,string);
                    if(price == 0) format(string, sizeof(string), "Vocк foi preso por %d minutos, Fianзa: Nenhuma.", timefix);
                    else format(string, sizeof(string), "Vocк foi preso por %d minutos, Fianзa: $%d.", timefix, price);
				    SendClientMessage(targetid, COLOR_LIGHTRED, string);
//        	        if(timefixfix == 999999999) SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк foi preso perpetuamente, digite (/mudarnome) para sair.");
		            SetPVarInt(targetid, "Jailed", 3);
		            SetPlayerPos(targetid, 257.6676,1425.4663,10.5930);
		            SetPlayerInterior(targetid,0);
		            SetPlayerVirtualWorld(targetid,0);
		            SetPVarInt(targetid, "WantedLevel", 0);
//					else SetPVarInt(targetid, "Jailed", 4), SetPlayerPos(targetid,257.6676,1425.4663,10.5930);
        	        SetPVarInt(targetid, "Jailtime", timefix), SetPVarInt(targetid, "Arrest", GetPVarInt(targetid, "Arrest")+1);
        	        SetPVarInt(targetid, "Cuffed", 60), SetPVarInt(targetid, "Cuffedtimefix", 60);
        	        SetPVarInt(targetid, "InvWeapon", 0), SetPVarInt(targetid, "InvAmmo", 0);
        	        SetPVarInt(targetid, "DuffleBag", 0), SetPVarInt(targetid, "Bomb", 0);
					ResetPlayerWeaponsEx(targetid), RemovePlayerAttachedObject(targetid, HOLDOBJECT_GUN2);
    	            TogglePlayerControllable(targetid,true);
    	            for(new i = 0; i < 5; i++)
		            {
			            if(PlayerInfo[targetid][pTicket][i] > 0)
			            {
	   	    		        PlayerInfo[targetid][pTicket][i]=0;
	   	    		        strmid(TicketReason[targetid][i], "None", 0, strlen("None"), 255);
	    	            }
		            }
        	    }
        	    else SendClientMessage(playerid, COLOR_GREY, "Vocк nгo estб prуximo da prisгo.");
        	}
        	else SendClientMessage(playerid, COLOR_GREY, "Vocк nгo estб prуximo suficiente deste jogador.");
		}
	}
	return 1;
}
Reply
#2

PHP код:
new timefixfix timefix*60
Dai inves de usar o timefix para salvar vc substitui por timefixfix ou se quiser uma variavel sу para o tempo vc usa a timefix e na hora de setar usa sempre:
PHP код:
 timefix*60 
Ex:
PHP код:
SetPVarInt(targetid"Jailtime"timefix*60
Reply
#3

Como assim? nгo entendi, tem como me explicar? kkk
Se quiser, skp: mati_galdiano
Reply
#4

PHP код:
COMMAND:prisao(playeridparams[])
{
    new 
targetid,timefix,string[128],price,sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
    if(
sscanf(params"uii"targetidtimefixprice)) return SendClientMessage(playeridCOLOR_LIGHTRED"USE: /prisao [id] [tempo(minutos)] [fianзa($2000-$80000)-($0 Nenhuma)]");

    if(
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"Vocк deve estar logado para utilizar este comando.");
    if(
PlayerInfo[playerid][pdSuspensionDay] > 0) return SendClientMessage(playeridCOLOR_LIGHTRED"Vocк estб atualmente suspenso da LSPD!");
    
//if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode prender vocк mesmo.");
    
if (!IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_WHITE"Este jogador nгo estб conectado !");
    if(
timefix || timefix 3000) return SendClientMessage(playeridCOLOR_GREY"O tempo nгo pode ser menor que 1 ou maior que 3000.");
    if(
price != 0)
    {
        if(
price 2000 || price 80000) return SendClientMessage(playeridCOLOR_GREY"A fianзa nгo pode ser menos que 2000 ou maior que 80000.");
    }
    if(
GetPVarInt(playerid"Member") == || GetPVarInt(playerid"Member") == 7)
    {
        if(
PlayerToPlayer(playerid,targetid,5.0))
        {
            if(
IsPlayerInRangeOfPoint(playerid,10.0,321.9542,314.4457,999.1484))
            {
                
//if(GetPVarInt(targetid, "Strikes") >= 3) timefixfix = 999999999, SetPVarInt(targetid, "Changes", GetPVarInt(targetid, "Changes")+1);
                   
format(sendernamesizeof(sendername), "%s"PlayerName(playerid)), format(giveplayersizeof(giveplayer), "%s"PlayerName(targetid));
                  
GiveNameSpace(sendername), GiveNameSpace(giveplayer);
                
format(stringsizeof(string), "[Prisгo]: O oficial %s prendeu %s na San Andreas High Facility Prison."sendernamegiveplayer);
                
SendFactionMessage(7,COLOR_RED,string);
                if(
price == 0format(stringsizeof(string), "Vocк foi preso por %d minutos, Fianзa: Nenhuma."timefix*60);
                else 
format(stringsizeof(string), "Vocк foi preso por %d minutos, Fianзa: $%d."timefix*60price);
                
SendClientMessage(targetidCOLOR_LIGHTREDstring);
                
//if(timefixfix == 999999999) SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк foi preso perpetuamente, digite (/mudarnome) para sair.");
                
SetPVarInt(targetid"Jailed"3);
                
SetPlayerPos(targetid257.6676,1425.4663,10.5930);
                
SetPlayerInterior(targetid,0);
                
SetPlayerVirtualWorld(targetid,0);
                
SetPVarInt(targetid"WantedLevel"0);
                
//else SetPVarInt(targetid, "Jailed", 4), SetPlayerPos(targetid,257.6676,1425.4663,10.5930);
                
SetPVarInt(targetid"Jailtime"timefix*60), SetPVarInt(targetid"Arrest"GetPVarInt(targetid"Arrest")+1);
                
SetPVarInt(targetid"Cuffed"60), SetPVarInt(targetid"Cuffedtimefix"60);
                
SetPVarInt(targetid"InvWeapon"0), SetPVarInt(targetid"InvAmmo"0);
                
SetPVarInt(targetid"DuffleBag"0), SetPVarInt(targetid"Bomb"0);
                
ResetPlayerWeaponsEx(targetid), RemovePlayerAttachedObject(targetidHOLDOBJECT_GUN2);
                
TogglePlayerControllable(targetid,true);
                for(new 
05i++)
                {
                    if(
PlayerInfo[targetid][pTicket][i] > 0)
                    {
                           
PlayerInfo[targetid][pTicket][i]=0;
                           
strmid(TicketReason[targetid][i], "None"0strlen("None"), 255);
                    }
                }
            }
            else 
SendClientMessage(playeridCOLOR_GREY"Vocк nгo estб prуximo da prisгo.");
        }
        else 
SendClientMessage(playeridCOLOR_GREY"Vocк nгo estб prуximo suficiente deste jogador.");
    }
    return 
1;

Reply
#5

Ainda continua a mesma coisa, prendendo por segundos.
Reply
#6

Sу editar:
PHP код:
if(price == 0format(stringsizeof(string), "Vocк foi preso por %d minutos, Fianзa: Nenhuma."timefix);
else 
format(stringsizeof(string), "Vocк foi preso por %d minutos, Fianзa: $%d."timefixprice); 
Dai ele adiciona o tempo certo(em segundos). Vc tem um comando pra ver o tempo que ta preso? se sim manda ai.
Reply
#7

Aqui.
Quote:

if(GetPVarInt(playerid, "Jailed") > 0)
{
format(string, sizeof(string), "Tempo de Sentenca: %d segundos.", GetPVarInt(playerid, "JailTime"));
return GameTextForPlayer(playerid, string, 5000, 1);
}

Reply
#8

PHP код:
if(GetPVarInt(playerid"Jailed") > 0)
{
    
format(stringsizeof(string), "Tempo de Sentenca: %s."Convert(GetPVarInt(playerid"JailTime")));
    return 
GameTextForPlayer(playeridstring50001);

final do gm:
PHP код:
stock Convert(number)
{
    new 
hours 0mins 0secs 0string[100];
    
hours floatround(number 3600);
    
mins floatround((number 60) - (hours 60));
    
secs floatround(number - ((hours 3600) + (mins 60)));
    new 
days 0;
    if(
hours >= 24)
    {
        
days floatround((hours/24), floatround_floor);
        
hours hours 24;
    }
    if(
days 0)
    {
        
format(string100"%ddias, %dh %dm e %ds"dayshoursminssecs);
    }
    else if(
hours 0)
    {
        
format(string100"%dh %dm e %ds"hoursminssecs);
    }
    else
    {
        
format(string100"%dm e %ds"minssecs);
    }
    return 
string;

Reply
#9

Agora deu uma parada mу estranha
Quote:

../gamemodes/OnCommand.pwn(12893) : error 001: expected token: ",", but found "-integer value-"
../gamemodes/OnCommand.pwn(12893) : warning 215: expression has no effect
../gamemodes/OnCommand.pwn(12893) : error 001: expected token: ";", but found ")"
../gamemodes/OnCommand.pwn(12893) : error 029: invalid expression, assumed zero
../gamemodes/OnCommand.pwn(12893) : fatal error 107: too many error messages on one line

O erro aн se encontra aqui nessa linha:
Quote:

SetPVarInt(targetid, "Jails", GetPVarInt(targetid, "Jails")+1);

Reply
#10

Mano, consegui, valeu!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)