help - Simple checkpoint for repair -
gotwarzone - 07.03.2014
Hi. Can you please help me make a simple checkpoint for repair vehicle?
When a player with a vehicle land on a checkpoint. the vehicle will freeze and starts repairing. I was ******ing if there are some tuts but there are none.
Thanks!
Re: help - Simple checkpoint for repair -
Lajko1 - 07.03.2014
OnPlayerEnterCheckpoint - TogglePlayerControllable - SetVehicleHealth - GivePlayerMoney - done
Re: help - Simple checkpoint for repair -
gotwarzone - 08.03.2014
Very well explained. Hope someone help me with a simple coding as well.
Re: help - Simple checkpoint for repair -
GrandParadise - 08.03.2014
Код:
if(strcmp(cmdtext, "/repair", true)==0)
{
if(IsPlayerInCheckpoint(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
Freeze(vehicleid);
SetTimerEx("Unfreeze", 5000, false, "i", playerid
}
else
{
SendClientMessage(playerid, red, "Error: You need to be in a vehicle to repair it!");
}
}
else
{
SendClientMessage(playerid, red, "Error: You are not in the checkpoint!");
}
return 1;
}
Re: help - Simple checkpoint for repair -
gotwarzone - 08.03.2014
Quote:
Originally Posted by GrandParadise
Код:
if(strcmp(cmdtext, "/repair", true)==0)
{
if(IsPlayerInCheckpoint(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
}
else
{
SendClientMessage(playerid, red, "Error: You need to be in a vehicle to repair it!");
}
}
else
{
SendClientMessage(playerid, red, "Error: You are not in the checkpoint!");
}
return 1;
}
|
Wow thanks +rep, and how about if I will make a message that will show only when he enter the repair checkpoint?
Let say I landed on the checkpoint and a message will appear "Press Alt Key to Repair your vehicle" and which is better textdraw or gametextforplay?
EDIT: also the repair will take 5 seconds
Re: help - Simple checkpoint for repair -
GrandParadise - 08.03.2014
I'd rather use textdraw as it looks more professional.
Re: help - Simple checkpoint for repair -
gotwarzone - 08.03.2014
Yeah right! Lol anyway the script you posted. Is the freeze forever? Can you add a timer after 5 seconds freeze then after the 6 seconds it will unfrozen.
Re: help - Simple checkpoint for repair -
ReD_HunTeR - 08.03.2014
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 0, 0, 0, 3.0); //fill the things...
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
TogglePlayerControllable(playerid,0);
SetTimerEx("srepair",10000,0,"i",playerid);
return 1;
}
forward srepair(playerid);
public srepair(playerid)
{
TogglePlayerControllable(playerid,1);
RepairVehicle(GetPlayerVehicleID(playerid));
GameTextForPlayer(playerid,"~n~~g~Vehicle ~r~Repaired",3000,3);
return 1;
}
Re: help - Simple checkpoint for repair -
gotwarzone - 08.03.2014
Thanks blackbomb you just bombed my world! I also like to ask something.
Do you think it's possible if I enter the repair checkpoint, my damaged vehicle will start repairing every seconds? Let say my vehicle hp is 500 (half of 1000 max hp) when I enter the checkpoint it will raise by 30hp each seconds? Without freezing the vehicle? then when I leave the repair checkpoint it will stop repairing.
Re: help - Simple checkpoint for repair -
gotwarzone - 08.03.2014
Hi anyone?