SA-MP Forums Archive
No me funciona el comando - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: No me funciona el comando (/showthread.php?tid=635306)



No me funciona el comando - Nicosm - 05.06.2017

Hola, el comando no funciona, me tira error que no soy ladrуn pero si tengo el job.
Y si quito esa excepciуn no hace ninguna funciуn (ni da errores)

Код:
	CMD:robarpersona(playerid, params[])
	{
	if(Info[playerid][pJob] == 17 || Info[playerid][pJob2] == 17) return SendClientMessageEx(playerid, ERROR, "No eres ladrуn.");
        {
		    if(!sscanf(params, "s[32]", params[0]))
		    {
		        new string[128];
		            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", GetPlayerNameEx(playerid), GetPlayerNameEx(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.", GetPlayerNameEx(victim), GetPlayerNameEx(playerid));
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							SendClientMessageEx(params[0], COLOR_YELLOW2, "-> ЎEvitaste que te robaran!");
					    }
					    new rob = random(2)+1;
					    if(rob == 1)
					    {
                           GivePlayerCash(params[0], -575);
					        format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y lo logra", GetPlayerNameEx(playerid) ,GetPlayerNameEx(params[0]));
							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.", GetPlayerNameEx(playerid) ,GetPlayerNameEx(params[0]));
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							SendClientMessageEx(params[0], COLOR_YELLOW2, "ЎTe han robado dinero!");
							SendClientMessageEx(playerid, COLOR_YELLOW2, "ЎHas robado dinero!");
							 GivePlayerCash(playerid, 575);
						}
						else
						{
      						format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla", GetPlayerNameEx(playerid), GetPlayerNameEx(params[0]));
							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.", GetPlayerNameEx(params[0]), GetPlayerNameEx(playerid));
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							SendClientMessageEx(params[0], COLOR_GENERAL, "Has evitado que te roben.");
							SendClientMessageEx(playerid, COLOR_YELLOW, "La persona que le intentaste robar te descubriу, ЎCorre!");
						}
		            }
				 }
			  }
		        return 1;
	  }



Respuesta: No me funciona el comando - mcreed - 10.06.2017

Suponiendo que la ID del trabajo de ladrуn es 17, entonces serнa asн:
pawn Код:
CMD:robarpersona(playerid, params[])
    {
    if(Info[playerid][pJob] != 17 && Info[playerid][pJob2] != 17) return SendClientMessageEx(playerid, ERROR, "No eres ladrуn.");
            if(!sscanf(params, "s[32]", params[0]))
            {
                new string[128];
                    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", GetPlayerNameEx(playerid), GetPlayerNameEx(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.", GetPlayerNameEx(victim), GetPlayerNameEx(playerid));
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            SendClientMessageEx(params[0], COLOR_YELLOW2, "-> ЎEvitaste que te robaran!");
                        }
                        new rob = random(2)+1;
                        if(rob == 1)
                        {
                           GivePlayerCash(params[0], -575);
                            format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y lo logra", GetPlayerNameEx(playerid) ,GetPlayerNameEx(params[0]));
                            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.", GetPlayerNameEx(playerid) ,GetPlayerNameEx(params[0]));
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            SendClientMessageEx(params[0], COLOR_YELLOW2, "ЎTe han robado dinero!");
                            SendClientMessageEx(playerid, COLOR_YELLOW2, "ЎHas robado dinero!");
                             GivePlayerCash(playerid, 575);
                        }
                        else
                        {
                            format(string, sizeof(string), "%s intenta robarle a %s sin que se de cuenta y falla", GetPlayerNameEx(playerid), GetPlayerNameEx(params[0]));
                            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.", GetPlayerNameEx(params[0]), GetPlayerNameEx(playerid));
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            SendClientMessageEx(params[0], COLOR_GENERAL, "Has evitado que te roben.");
                            SendClientMessageEx(playerid, COLOR_YELLOW, "La persona que le intentaste robar te descubriу, ЎCorre!");
                        }
                    }
                 }
                return 1;
      }