Can't attack twice in row
#5

ok but i got bugs see my script
Код:
//-----Can't Attack twice in row--//
new Attacked[MAX_PLAYERS] = INVALID_PLAYER_ID;
this is on top after includes

Код:
   	CMD:rape(playerid)
{

    if(PlayerDuelWatching[playerid] == 1) return SCM(playerid,COLOR_RED," You can't use this command while watching duel /leavewatch");
    new nPlayer = GetClosestPlayer(playerid);
    if(pInfo[playerid][belt] == 1) return SCM(playerid,COLOR_RED,"You can't rape while wearing a belt");
    if(blockedrape == 1) return SCM(playerid, COLOR_RED, "/Rape is blocked by admin");
   	if(Attacked[playerid] == nPlayer) return SCM(playerid, -1, "You cannot attack the same player twice in row.");
	//if(RestrictCMD == 1) return  SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command reason:[DISABLED]");
	if(spawned[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command While Dead.");
	if(IsPlayerInAnyVehicle(playerid)) return  SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command While In A Vehicle.");
	if(spawned[nPlayer] == 0) return SendClientMessage(playerid, COLOR_RED, "You Cannot Rape A Dead Body.");
    //if(OnDuty[nPlayer] == 1) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command on an admin on duty");
	//if(IsInChallenge[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You cannot rape in a challenge. You can take drugs and use /ad.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"Error: You cannot use this command in a vehicle.");
	if(spectate[nPlayer] == 1) return SendClientMessage(playerid, COLOR_RED, "Nobody close enough to rape.");
	//if(duel[nPlayer] == 1) return SendClientMessage(playerid, COLOR_RED, "you cannot rape in duel area");
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid,x,y,z);
	if(rape[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"Error: Please wait before raping again.");

	if(IsPlayerInRangeOfPoint(nPlayer,6.0,x,y,z))
	{
        if(aduty[nPlayer] == 1) return SCM(playerid, COLOR_RED,"You can't use this command on onduty admin.");
        //if(pInfo[nPlayer][Adminlevel] > 1) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
	    if(IsPlayerInAnyVehicle(nPlayer)) return SendClientMessage(playerid,COLOR_RED,"Error: The nearest player is in a vehicle.");
	    rape[playerid] =1;
	    RapeRecent1[playerid] = SetTimerEx("RapeRecent",10*1000,0,"i",playerid);
		if(pInfo[playerid][belt] == 0)
		{
	    switch(random(9))
	    {

	        case  1, 2, 3:
	        {
				GameTextForPlayer(playerid,"Raping Failed",4500,3);
				pInfo[nPlayer][belt] = 0;
				new string[128];
				format(string,sizeof(string),"%s Has attempted to rape you.",PlayerName(playerid));
				SendClientMessage(nPlayer,COLOR_RED,string);
				//SetPVarInt(playerid, "CanRape", 0);
				//RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",40000,0,"i",playerid);
	        }
	        case 4, 5:
	        {
                if(pInfo[nPlayer][belt] == 1) SCM(playerid,COLOR_RED,"You Broke his belt");
                pInfo[nPlayer][belt] = 0;
                SCM(nPlayer,COLOR_RED,"Your Belt is Broken");
	            new string[128], str[128];
				new Float:myhealth, Float:he;
				GetPlayerHealth(nPlayer,myhealth);
				SetPlayerHealth(nPlayer,myhealth-float(random(40)));
				GetPlayerHealth(nPlayer, he);
				format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
				if(he <= 0.0) SendClientMessageToAll(COLOR_RED, str);
				new Float:x1, Float:y1, Float:z1;
				GetPlayerPos(nPlayer,x1,y1,z1);
				SetPlayerPos(nPlayer,x1,y1,z1+1);
			    format(string,sizeof(string),"%s Has raped you.",PlayerName(playerid));
				SendClientMessage(nPlayer,0x00FFFFC8,string);
				format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
				SendClientMessage(playerid,0x00FFFFC8,string);
				format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
				GameTextForPlayer(playerid,string,5000,3);
				format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
				GameTextForPlayer(nPlayer,string,5000,3);
				SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
				Attacked[playerid] = nPlayer;
				//SetPVarInt(playerid, "CanRape", 0);
				///RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",1000*40,0,"i",playerid);
	        }
	        case 6, 7:
	        {
	            if(pInfo[nPlayer][belt] == 1) SCM(playerid,COLOR_RED,"You Broke his belt");
	            pInfo[nPlayer][belt] = 0;
	            SCM(nPlayer,COLOR_RED,"Your Belt is Broken");
	            new string[128], str[128];
				new Float:myhealth, Float:he;
				GetPlayerHealth(nPlayer,myhealth);
				SetPlayerHealth(nPlayer,myhealth-float(random(30)));
				GetPlayerHealth(nPlayer, he);
				format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
				if(he <= 0.0) SendClientMessageToAll(COLOR_MAROON, str);
				new Float:x1, Float:y1, Float:z1;
				GetPlayerPos(nPlayer,x1,y1,z1);
				SetPlayerPos(nPlayer,x1,y1,z1+1);
			    format(string,sizeof(string),"%s has raped you.",PlayerName(playerid));
				SendClientMessage(nPlayer,0x00FFFFC8,string);
				format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
				SendClientMessage(playerid,0x00FFFFC8,string);
				format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
				GameTextForPlayer(playerid,string,5000,3);
				format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
				GameTextForPlayer(nPlayer,string,5000,3);
				SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
				Attacked[playerid] = nPlayer;
				//SetPVarInt(playerid, "CanRape", 0);
				//RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",1000*40,0,"i",playerid);
	        }
	        case 8, 9:
	        {
	            if(pInfo[nPlayer][belt] == 1) SCM(playerid,COLOR_RED,"You Broke his belt");
	            pInfo[nPlayer][belt] = 0;
	            SCM(nPlayer,COLOR_RED,"Your Belt is Broken");
	            new string[128], str[128];
				new Float:myhealth, Float:he;
				GetPlayerHealth(nPlayer,myhealth);
				SetPlayerHealth(nPlayer,myhealth-float(random(20)));
				GetPlayerHealth(nPlayer, he);
				format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
				if(he <= 0.0) SendClientMessageToAll(COLOR_MAROON, str);
				new Float:x1, Float:y1, Float:z1;
				GetPlayerPos(nPlayer,x1,y1,z1);
				SetPlayerPos(nPlayer,x1,y1,z1+1);
			    format(string,sizeof(string),"%s has raped you.",PlayerName(playerid));
				SendClientMessage(nPlayer,0x00FFFFC8,string);
				format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
				SendClientMessage(playerid,0x00FFFFC8,string);
				format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
				GameTextForPlayer(playerid,string,5000,3);
				format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
				GameTextForPlayer(nPlayer,string,5000,3);
				SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
				Attacked[playerid] = nPlayer;
	        }
	    }
	}
		if(pInfo[playerid][belt] == 1)
	{
	switch(random(16))
 	{
	case  1, 2, 3:
	        {
				GameTextForPlayer(playerid,"Raping Failed But Broked His Belt",4500,3);
				pInfo[nPlayer][belt] = 0;
				new string[128];
				format(string,sizeof(string),"%s Has attempted to rape you.And Broked You Belt",PlayerName(playerid));
				SendClientMessage(nPlayer,COLOR_RED,string);
				//SetPVarInt(playerid, "CanRape", 0);
				//RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",40000,0,"i",playerid);
	        }
	        case 4:
	        {
                if(pInfo[nPlayer][belt] == 1) SCM(playerid,COLOR_RED,"You Broke his belt");
                pInfo[nPlayer][belt] = 0;
                SCM(nPlayer,COLOR_RED,"Your Belt is Broken");
	            new string[128], str[128];
				new Float:myhealth, Float:he;
				GetPlayerHealth(nPlayer,myhealth);
				SetPlayerHealth(nPlayer,myhealth-float(random(40)));
				GetPlayerHealth(nPlayer, he);
				format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
				if(he <= 0.0) SendClientMessageToAll(COLOR_RED, str);
				new Float:x1, Float:y1, Float:z1;
				GetPlayerPos(nPlayer,x1,y1,z1);
				SetPlayerPos(nPlayer,x1,y1,z1+1);
			    format(string,sizeof(string),"%s Has raped you.",PlayerName(playerid));
				SendClientMessage(nPlayer,0x00FFFFC8,string);
				format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
				SendClientMessage(playerid,0x00FFFFC8,string);
				format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
				GameTextForPlayer(playerid,string,5000,3);
				format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
				GameTextForPlayer(nPlayer,string,5000,3);
				SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
				Attacked[playerid] = nPlayer;
				//SetPVarInt(playerid, "CanRape", 0);
				///RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",1000*40,0,"i",playerid);
	        }
	        case 6:
	        {
	            if(pInfo[nPlayer][belt] == 1) SCM(playerid,COLOR_RED,"You Broke his belt");
	            pInfo[nPlayer][belt] = 0;
	            SCM(nPlayer,COLOR_RED,"Your Belt is Broken");
	            new string[128], str[128];
				new Float:myhealth, Float:he;
				GetPlayerHealth(nPlayer,myhealth);
				SetPlayerHealth(nPlayer,myhealth-float(random(30)));
				GetPlayerHealth(nPlayer, he);
				format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
				if(he <= 0.0) SendClientMessageToAll(COLOR_MAROON, str);
				new Float:x1, Float:y1, Float:z1;
				GetPlayerPos(nPlayer,x1,y1,z1);
				SetPlayerPos(nPlayer,x1,y1,z1+1);
			    format(string,sizeof(string),"%s has raped you.",PlayerName(playerid));
				SendClientMessage(nPlayer,0x00FFFFC8,string);
				format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
				SendClientMessage(playerid,0x00FFFFC8,string);
				format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
				GameTextForPlayer(playerid,string,5000,3);
				format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
				GameTextForPlayer(nPlayer,string,5000,3);
				SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
				Attacked[playerid] = nPlayer;
				//SetPVarInt(playerid, "CanRape", 0);
				//RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",1000*40,0,"i",playerid);
	        }
	        case 8:
	        {
	            if(pInfo[nPlayer][belt] == 1) SCM(playerid,COLOR_RED,"You Broke his belt");
	            pInfo[nPlayer][belt] = 0;
	            SCM(nPlayer,COLOR_RED,"Your Belt is Broken");
	            new string[128], str[128];
				new Float:myhealth, Float:he;
				GetPlayerHealth(nPlayer,myhealth);
				SetPlayerHealth(nPlayer,myhealth-float(random(20)));
				GetPlayerHealth(nPlayer, he);
				format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
				if(he <= 0.0) SendClientMessageToAll(COLOR_MAROON, str);
				new Float:x1, Float:y1, Float:z1;
				GetPlayerPos(nPlayer,x1,y1,z1);
				SetPlayerPos(nPlayer,x1,y1,z1+1);
			    format(string,sizeof(string),"%s has raped you.",PlayerName(playerid));
				SendClientMessage(nPlayer,0x00FFFFC8,string);
				format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
				SendClientMessage(playerid,0x00FFFFC8,string);
				format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
				GameTextForPlayer(playerid,string,5000,3);
				format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
				GameTextForPlayer(nPlayer,string,5000,3);
				SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
				Attacked[playerid] = nPlayer;
			}
			case 10,11,12,13,14,15,5,7,9:
   			{
				return SCM(playerid,COLOR_RED,"You can't rape him he is Wearing Belt");
			}
		}
	}
	}
	else
	{
	    SendClientMessage(playerid,COLOR_RED,"Nobody close enough to rape.");
	}
	return 1;
}
This is whole cmd
Код:
if(Attacked[playerid] == nPlayer) return SCM(playerid, -1, "You cannot attack the same player twice in row.");
this i added in the cmd
Код:
Attacked[playerid] = nPlayer;
when you rape the player

now the problem is it will work first time until we pass to rape him but after that we can't rape any player it says
Код:
You cannot attack the same player twice in row.
Reply


Messages In This Thread
Can't attack twice in row - by AroseKhanNiazi - 18.03.2014, 13:16
Re: Can't attack twice in row - by MP2 - 18.03.2014, 19:40
Re: Can't attack twice in row - by Lajko1 - 18.03.2014, 23:01
Re: Can't attack twice in row - by Abagail - 18.03.2014, 23:04
Re: Can't attack twice in row - by AroseKhanNiazi - 19.03.2014, 11:49
Re: Can't attack twice in row - by AroseKhanNiazi - 20.03.2014, 15:54
AW: Can't attack twice in row - by Macronix - 20.03.2014, 15:58
Re: Can't attack twice in row - by AroseKhanNiazi - 20.03.2014, 16:49
AW: Can't attack twice in row - by Macronix - 20.03.2014, 18:43
Re: Can't attack twice in row - by AroseKhanNiazi - 21.03.2014, 08:12

Forum Jump:


Users browsing this thread: 1 Guest(s)