Two things - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Two things (
/showthread.php?tid=520816)
Two things -
LostGaming2014 - 20.06.2014
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;
}
Re: Two things -
Laurey - 20.06.2014
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.
Re : Two things -
MCZOFT - 20.06.2014
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(playerid, sendername, sizeof(sendername));
new vehicleid = GetPlayerVehicleID(playerid);
new Float:Vehhp;
GetVehicleHealth(vehicleid, Vehhp);
if(CarInfo[VehicleOwned[vehicleid]][cOwned] == 1) {
GetPlayerName(playerid, name, sizeof(name));
if(strcmp(name, CarInfo[VehicleOwned[vehicleid]][cOwner], true) == 1) {
if(Engine[vehicleid] == 1) {
if(Vehhp <= 350) {
Engine[vehicleid] = 0;
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_RED, "Status: repair needed : engine dead");
return 1;
}
}
}
}
}
change the CarInfo[VehicleOwned[vehicleid]][cOwner] to your own in the gamemode