[Ayuda] Comando /robar
#1

Tengo un problema con el comando robar, cuando roba una propiedad, al estar en una casa me aparece el mensaje
"No estas cerca de una casa" muchas veces seguidas, y al final el mensaje que me dice si pude o no robar la casa.
Si no estoy cerca de una casa es lo mismo, me aparece muchas veces seguidas el mensaje "No estas cerca de una casa". їQue puedo hacer para que solo aparezca una vez?
Este es el comando:
Код:
	zcmd(robar, playerid, params[])
    {
        if(PlayerInfo[playerid][pJailed] > 0) return Message(playerid, COLOR_GREY, "No puedes usar esto aquн.");
        if(Pandilleros(playerid) || PlayerInfo[playerid][pJob] == 5)
		{
		    if(!sscanf(params, "s[32]", params[0]))
		    {
		        new string[128];
		        if(strcmp(params[0],"persona",true) == 0)
		        {
		            if(PlayerInfo[playerid][pRob] > 4) return Message(playerid, COLOR_GRAD2, "ЎYa has robado 5 veces, espera al prуximo PayDay!");
		            new victim = GetClosestPlayer(playerid);
		            if(ProxDetectorS(2.0,playerid, victim))
		            {
                        if(GetPlayerWeapon(victim) == 41)
		    			{
	        				format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla", PlayerName(playerid), PlayerName(victim));
							ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
       						format(string, sizeof(string), "* %s le rocнa la cara con un spray anti-ladrones a %s.", PlayerName(victim), PlayerName(playerid));
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							PlayerInfo[playerid][pRob] += 1;
							Message(victim, COLOR_YELLOW2, "-> ЎEvitaste que te robaran!");
					    }
					    new rob = random(2);
					    if(rob == 1)
					    {
	        				PlayerInfo[victim][pPnumber] = 0;
					        format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y lo logra", PlayerName(playerid) ,PlayerName(victim));
							ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
       						format(string, sizeof(string), "* %s se acerca hacia %s y le roba su telйfono.", PlayerName(playerid) ,PlayerName(victim));
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							Message(victim, COLOR_YELLOW2, "-> ЎTe han robado el telйfono!");
							Message(playerid, COLOR_YELLOW2, "-> ЎHas robado un telйfono! Vйndelo en el NPC");
							PlayerInfo[playerid][pRob] += 1;
							TelfRob[playerid] += 1;
						}
						else
						{
      						format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla", PlayerName(playerid), PlayerName(victim));
							ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
       						format(string, sizeof(string), "* %s se da cuenta y le da un golpe de puсo a %s.", PlayerName(victim), PlayerName(playerid));
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							Message(victim, COLOR_GREEN, "-> Has evitado que te roben!");
							Message(playerid, COLOR_YELLOW, "Te han pillado Jilipollas! Menudo ostiуn te has llevado! Corre!");
							PlayerInfo[playerid][pRob] += 1;
						}
		            }
		        }
		        else if(strcmp(params[0],"24-7",true) == 0)
		        {
		            if(!IsAt247(playerid)) return Message(playerid, COLOR_GRAD2, "ЎNo estбs en el 24/7!");
		            if(PlayerInfo[playerid][pRob] > 0) return Message(playerid, COLOR_GRAD2, "ЎYa robaste, espera al prуximo PayDay!");
		            else
		            {
		            	new robmoney = random(2200);
			            Earn(playerid, robmoney);
						ApplyAnimation(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 0, 0, 0, 0, 4000); // Rob
						PlayerInfo[playerid][pRob] += 1;
						format(string, sizeof(string), "* %s amenaza con un arma al vendedor", PlayerName(playerid));
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		            }
				}
		        else if(strcmp(params[0],"propiedad",true) == 0)
		        {
		            if(PickLock[playerid] == 0) return Message(playerid, COLOR_GRAD2, "ЎNo tienes con que forzar la cerradura!");
		            if(PlayerInfo[playerid][pRob] > 0) return Message(playerid, COLOR_GRAD2, "ЎYa robaste, espera al prуximo PayDay!");
		            for(new i = 0; i < sizeof(HouseInfo); i++)
					{
						if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
						{
						    new Float:cx,Float:cy,Float:cz;
							GetPlayerPos(playerid, cx, cy, cz);
						    new luck = random(8)
							if(luck == 3 || luck == 7)
							{
							    format(string, sizeof(string), "* %s fuerza la cerradura de la casa, entra y roba todo lo que puede.", PlayerName(playerid));
					      		ProxDetector(8.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					      		new cash = random(6000);
								PlayerInfo[playerid][pRob] = 1;
								SendRadioMessage(1, TEAM_BLUE_COLOR, "** Central: Atenciуn se ha producido un robo en una casa de la Ciudad, No tenemos el lugar exacto!");
								for(new x = 0; x < MAX_PLAYERS; x++)
								{
									if(IsPlayerConnected(x))
									{
					    				if(Team_LSPD(playerid))
									    {
													SetPlayerCheckpoint(x, cx, cy, cz, 3.0);
										}
									}
								}
						        Earn(playerid, cash);
				  				ProxDetector(30.0, playerid, "* Piiiiiiiiiiiiiiii Piiiiiiiiiiiiiiiii (( Alarma Sonando ))", COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
				 	            return 1;
							}
							else
							{
							    format(string, sizeof(string), "* %s rompe su alambre al intentar forzar la cerradura.", PlayerName(playerid));
					      		ProxDetector(8.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					      		SendClientMessage(playerid, COLOR_YELLOW2, "Fallaste al abrir la casa ...");
					      		PlayerInfo[playerid][pRob] = 1;
					      		return 1;
							}
						}
						else Message(playerid, COLOR_GRAD2, "ЎNo estбs cerca de una casa!");
					}
		        }
		    }
		    else Message(playerid, COLOR_GRAD2, "Utilize: /robar <24-7> <Persona> <Propiedad>");
		}
		return 1;
	}
Reply
#2

PHP код:
CMD:robar(playeridparams[])
{
    if(
PlayerInfo[playerid][pJailed] > 0)
        return 
Message(playeridCOLOR_GREY"No puedes usar esto aquн.");
    if(
Pandilleros(playerid) || PlayerInfo[playerid][pJob] == 5)
    {
        if(
sscanf(params"s[32]"params[0]))
            return 
Message(playeridCOLOR_GRAD2"Utilize: /robar <24-7> <Persona> <Propiedad>");
        new
            
string[128];
        if(
strcmp(params[0],"persona",true) == 0)
        {
            if(
PlayerInfo[playerid][pRob] > 4)
                return 
Message(playeridCOLOR_GRAD2"ЎYa has robado 5 veces, espera al prуximo PayDay!");
            new 
victim GetClosestPlayer(playerid);
            if(!
ProxDetectorS(2.0,playeridvictim))
                return 
Message(playeridCOLOR_GRAD2"No estas cerca del jugador!");
            if(
GetPlayerWeapon(victim) == 41)
            {
                
format(stringsizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla"PlayerName(playerid), PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                
format(stringsizeof(string), "* %s le rocнa la cara con un spray anti-ladrones a %s."PlayerName(victim), PlayerName(playerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
PlayerInfo[playerid][pRob] += 1;
                
Message(victimCOLOR_YELLOW2"-> ЎEvitaste que te robaran!");
            }
            new 
rob random(2);
            if(
rob == 1)
            {
                
PlayerInfo[victim][pPnumber] = 0;
                
format(stringsizeof(string), "%s intenta robarle a %s sin que se de cuenta y lo logra"PlayerName(playerid) ,PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
                
format(stringsizeof(string), "* %s se acerca hacia %s y le roba su telйfono."PlayerName(playerid) ,PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
Message(victimCOLOR_YELLOW2"-> ЎTe han robado el telйfono!");
                
Message(playeridCOLOR_YELLOW2"-> ЎHas robado un telйfono! Vйndelo en el NPC");
                
PlayerInfo[playerid][pRob] += 1;
                
TelfRob[playerid] += 1;
            }
            else
            {
                
format(stringsizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla"PlayerName(playerid), PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                
format(stringsizeof(string), "* %s se da cuenta y le da un golpe de puсo a %s."PlayerName(victim), PlayerName(playerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
Message(victimCOLOR_GREEN"-> Has evitado que te roben!");
                
Message(playeridCOLOR_YELLOW"Te han pillado Jilipollas! Menudo ostiуn te has llevado! Corre!");
                
PlayerInfo[playerid][pRob] += 1;
            }
        }
        else if(
strcmp(params[0],"24-7",true) == 0)
        {
            if(!
IsAt247(playerid))
                return 
Message(playeridCOLOR_GRAD2"ЎNo estбs en el 24/7!");
            if(
PlayerInfo[playerid][pRob] > 0)
                return 
Message(playeridCOLOR_GRAD2"ЎYa robaste, espera al prуximo PayDay!");
            new 
robmoney random(2200);
            
Earn(playeridrobmoney);
            
ApplyAnimation(playerid"SHOP""ROB_Loop_Threat"4.000004000); // Rob
            
PlayerInfo[playerid][pRob] += 1;
            
format(stringsizeof(string), "* %s amenaza con un arma al vendedor"PlayerName(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else if(
strcmp(params[0],"propiedad",true) == 0)
        {
            if(
PickLock[playerid] == 0)
                return 
Message(playeridCOLOR_GRAD2"ЎNo tienes con que forzar la cerradura!");
            if(
PlayerInfo[playerid][pRob] > 0)
                return 
Message(playeridCOLOR_GRAD2"ЎYa robaste, espera al prуximo PayDay!");
            new
                
PlayerIsNearHouse(playerid)
                ;
                
            if(
== -1)
                return 
Message(playeridCOLOR_GRAD2"ЎNo estбs cerca de una casa!");
            new 
Float:cx,Float:cy,Float:cz;
            
GetPlayerPos(playeridcxcycz);
            new 
luck random(8);
            if(
luck == || luck == 7)
            {
                
format(stringsizeof(string), "* %s fuerza la cerradura de la casa, entra y roba todo lo que puede."PlayerName(playerid));
                
ProxDetector(8.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                new 
cash random(6000);
                
PlayerInfo[playerid][pRob] = 1;
                
SendRadioMessage(1TEAM_BLUE_COLOR"** Central: Atenciуn se ha producido un robo en una casa de la Ciudad, No tenemos el lugar exacto!");
                for(new 
0MAX_PLAYERSx++)
                {
                    if(!
IsPlayerConnected(x))
                        continue;
                        
                    if(!
Team_LSPD(playerid))
                        continue;
                        
                    
SetPlayerCheckpoint(xcxcycz3.0);
                }
                
Earn(playeridcash);
                
ProxDetector(30.0playerid"* Piiiiiiiiiiiiiiii Piiiiiiiiiiiiiiiii (( Alarma Sonando ))"COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                return 
1;
            }
            else
            {
                
format(stringsizeof(string), "* %s rompe su alambre al intentar forzar la cerradura."PlayerName(playerid));
                
ProxDetector(8.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
SendClientMessage(playeridCOLOR_YELLOW2"Fallaste al abrir la casa ...");
                
PlayerInfo[playerid][pRob] = 1;
                return 
1;
            }
        }
    }
    return 
1;
}
stock PlayerIsNearHouse(playeridFloat:radius 3.0)
{
    for(new 
0sizeof(HouseInfo); i++)
    {
        if(
PlayerToPoint(radiusplayeridHouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
        {
            return 
i;
        }
    }
    return -
1;

Reply
#3

Quote:
Originally Posted by _Zume
Посмотреть сообщение
PHP код:
CMD:robar(playeridparams[])
{
    if(
PlayerInfo[playerid][pJailed] > 0)
        return 
Message(playeridCOLOR_GREY"No puedes usar esto aquн.");
    if(
Pandilleros(playerid) || PlayerInfo[playerid][pJob] == 5)
    {
        if(
sscanf(params"s[32]"params[0]))
            return 
Message(playeridCOLOR_GRAD2"Utilize: /robar <24-7> <Persona> <Propiedad>");
        new
            
string[128];
        if(
strcmp(params[0],"persona",true) == 0)
        {
            if(
PlayerInfo[playerid][pRob] > 4)
                return 
Message(playeridCOLOR_GRAD2"ЎYa has robado 5 veces, espera al prуximo PayDay!");
            new 
victim GetClosestPlayer(playerid);
            if(!
ProxDetectorS(2.0,playeridvictim))
                return 
Message(playeridCOLOR_GRAD2"No estas cerca del jugador!");
            if(
GetPlayerWeapon(victim) == 41)
            {
                
format(stringsizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla"PlayerName(playerid), PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                
format(stringsizeof(string), "* %s le rocнa la cara con un spray anti-ladrones a %s."PlayerName(victim), PlayerName(playerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
PlayerInfo[playerid][pRob] += 1;
                
Message(victimCOLOR_YELLOW2"-> ЎEvitaste que te robaran!");
            }
            new 
rob random(2);
            if(
rob == 1)
            {
                
PlayerInfo[victim][pPnumber] = 0;
                
format(stringsizeof(string), "%s intenta robarle a %s sin que se de cuenta y lo logra"PlayerName(playerid) ,PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
                
format(stringsizeof(string), "* %s se acerca hacia %s y le roba su telйfono."PlayerName(playerid) ,PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
Message(victimCOLOR_YELLOW2"-> ЎTe han robado el telйfono!");
                
Message(playeridCOLOR_YELLOW2"-> ЎHas robado un telйfono! Vйndelo en el NPC");
                
PlayerInfo[playerid][pRob] += 1;
                
TelfRob[playerid] += 1;
            }
            else
            {
                
format(stringsizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla"PlayerName(playerid), PlayerName(victim));
                
ProxDetector(30.0playeridstringCOLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                
format(stringsizeof(string), "* %s se da cuenta y le da un golpe de puсo a %s."PlayerName(victim), PlayerName(playerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
Message(victimCOLOR_GREEN"-> Has evitado que te roben!");
                
Message(playeridCOLOR_YELLOW"Te han pillado Jilipollas! Menudo ostiуn te has llevado! Corre!");
                
PlayerInfo[playerid][pRob] += 1;
            }
        }
        else if(
strcmp(params[0],"24-7",true) == 0)
        {
            if(!
IsAt247(playerid))
                return 
Message(playeridCOLOR_GRAD2"ЎNo estбs en el 24/7!");
            if(
PlayerInfo[playerid][pRob] > 0)
                return 
Message(playeridCOLOR_GRAD2"ЎYa robaste, espera al prуximo PayDay!");
            new 
robmoney random(2200);
            
Earn(playeridrobmoney);
            
ApplyAnimation(playerid"SHOP""ROB_Loop_Threat"4.000004000); // Rob
            
PlayerInfo[playerid][pRob] += 1;
            
format(stringsizeof(string), "* %s amenaza con un arma al vendedor"PlayerName(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else if(
strcmp(params[0],"propiedad",true) == 0)
        {
            if(
PickLock[playerid] == 0)
                return 
Message(playeridCOLOR_GRAD2"ЎNo tienes con que forzar la cerradura!");
            if(
PlayerInfo[playerid][pRob] > 0)
                return 
Message(playeridCOLOR_GRAD2"ЎYa robaste, espera al prуximo PayDay!");
            new
                
PlayerIsNearHouse(playerid)
                ;
                
            if(
== -1)
                return 
Message(playeridCOLOR_GRAD2"ЎNo estбs cerca de una casa!");
            new 
Float:cx,Float:cy,Float:cz;
            
GetPlayerPos(playeridcxcycz);
            new 
luck random(8);
            if(
luck == || luck == 7)
            {
                
format(stringsizeof(string), "* %s fuerza la cerradura de la casa, entra y roba todo lo que puede."PlayerName(playerid));
                
ProxDetector(8.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                new 
cash random(6000);
                
PlayerInfo[playerid][pRob] = 1;
                
SendRadioMessage(1TEAM_BLUE_COLOR"** Central: Atenciуn se ha producido un robo en una casa de la Ciudad, No tenemos el lugar exacto!");
                for(new 
0MAX_PLAYERSx++)
                {
                    if(!
IsPlayerConnected(x))
                        continue;
                        
                    if(!
Team_LSPD(playerid))
                        continue;
                        
                    
SetPlayerCheckpoint(xcxcycz3.0);
                }
                
Earn(playeridcash);
                
ProxDetector(30.0playerid"* Piiiiiiiiiiiiiiii Piiiiiiiiiiiiiiiii (( Alarma Sonando ))"COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                return 
1;
            }
            else
            {
                
format(stringsizeof(string), "* %s rompe su alambre al intentar forzar la cerradura."PlayerName(playerid));
                
ProxDetector(8.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
SendClientMessage(playeridCOLOR_YELLOW2"Fallaste al abrir la casa ...");
                
PlayerInfo[playerid][pRob] = 1;
                return 
1;
            }
        }
    }
    return 
1;
}
stock PlayerIsNearHouse(playeridFloat:radius 3.0)
{
    for(new 
0sizeof(HouseInfo); i++)
    {
        if(
PlayerToPoint(radiusplayeridHouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
        {
            return 
i;
        }
    }
    return -
1;

Gracias
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)