Posts: 512
Threads: 121
Joined: Sep 2013
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!
Posts: 1,233
Threads: 269
Joined: Oct 2008
Reputation:
0
OnPlayerEnterCheckpoint - TogglePlayerControllable - SetVehicleHealth - GivePlayerMoney - done
Posts: 512
Threads: 121
Joined: Sep 2013
Very well explained. Hope someone help me with a simple coding as well.
Posts: 48
Threads: 15
Joined: Jan 2013
08.03.2014, 06:21
(
Последний раз редактировалось GrandParadise; 08.03.2014 в 06:54.
)
Код:
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;
}
Posts: 512
Threads: 121
Joined: Sep 2013
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
Posts: 48
Threads: 15
Joined: Jan 2013
I'd rather use textdraw as it looks more professional.
Posts: 512
Threads: 121
Joined: Sep 2013
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.
Posts: 512
Threads: 121
Joined: Sep 2013
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.
Posts: 512
Threads: 121
Joined: Sep 2013