Two things
#1

I need two things, and that is a vehicle damage system so like; Lets say the vehicle HP goes down to 350, and then it wont turn on intill restored above 350 HP.

Second thing is I need to make it where if you hit your 'Y' key on your keybored it stuns/tazes the nearest players!

Thanks in advanced for whomever helps!


Here's the stun command if you could just throw it somewhere in this;

Код:
command(stun, playerid, params[])
{
	#pragma unused params
	new string[128], NearestPlayer = GetClosestPlayer(playerid);

    if(Groups[Player[playerid][Group]][CommandTypes] != 1 && Groups[Player[playerid][Group]][CommandTypes] != 4)
    {
        SendClientMessage(playerid, WHITE, "You're not a law enforcement officer!");
    }
    else if(Groups[Player[NearestPlayer][Group]][CommandTypes] == 1 || Groups[Player[NearestPlayer][Group]][CommandTypes] == 4)
    {
        SendClientMessage(playerid, WHITE, "Nearest player is a law enforcer!");
    }
    else
    {
	    if(GetDistanceBetweenPlayers(NearestPlayer, playerid) < 6)
        {
            if(Player[NearestPlayer][Tazed] == 0)
            {
                if(!IsPlayerInAnyVehicle(NearestPlayer))
                {
    				TogglePlayerControllable(NearestPlayer, false);
    				Player[NearestPlayer][Tazed] = 1;
    	    		format(string, sizeof(string), "* %s has stunned %s, with their taser.", GetName(playerid), GetName(NearestPlayer));
    	    		NearByMessage(playerid, PURPLE, string);
    	    		SendClientMessage(NearestPlayer, WHITE, "You have been tased. The effect will last for 12 seconds.");
    	    		SetTimerEx("UntazePlayer", 12000, false, "d", NearestPlayer);
    	    	}
    	    	else
    	    	{
    	    	    SendClientMessage(playerid, WHITE, "The suspect is in a vehicle, you can't tase whilst they're in a vehicle.");
    	    	}
    	    }
    	    else
    	    {
    	        SendClientMessage(playerid, WHITE, "That player is already stunned.");
    	    }
		}
		else
		{
		    SendClientMessage(playerid, WHITE, "No players in range!");
		}
	}
	return 1;
}
Reply
#2

Thats simple, for the vehicle health, in the engine starting command just return a message like
if(GetVehicleHealth(playerid) < 350) return SendClientMessage(playerid, -1, "The vehicle is too damaged to start!");
And for the stun thingy create a stock function which detects the nearest player and stuns him/her.
Reply
#3

to do that system of fail engine start ,

Go to your engine start CMD and compare to see what i've done



PHP код:
if(!strcmp(cmd"/enginestart"true))
{
    new 
name[MAX_PLAYER_NAME];
    new 
sendername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridsendernamesizeof(sendername));
    new 
vehicleid GetPlayerVehicleID(playerid);
    new 
Float:Vehhp;
    
GetVehicleHealth(vehicleidVehhp);
    if(
CarInfo[VehicleOwned[vehicleid]][cOwned] == 1) {
        
GetPlayerName(playeridnamesizeof(name));
        if(
strcmp(nameCarInfo[VehicleOwned[vehicleid]][cOwner], true) == 1) {
            if(
Engine[vehicleid] == 1) {
                if(
Vehhp <= 350) {
                    
Engine[vehicleid] = 0;
                    
TogglePlayerControllable(playerid1);
                    
SendClientMessage(playeridCOLOR_RED"Status: repair needed : engine dead");
                    return 
1;
                    }
           }
      }
   }

change the CarInfo[VehicleOwned[vehicleid]][cOwner] to your own in the gamemode
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)