Autofix - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Autofix (
/showthread.php?tid=261774)
Autofix -
Cenation - 15.06.2011
Hi frnds I have created Autofix script but there is no commands ok AutoFix but vehicle automatically get autofix can anyone create a command? (toggling command) /af, /autofix or anything u want...
for ex - /af (In-Game Text) AutoFix On /af (in-gametext) Autofix off... like that.. please...
Код:
//In GameModeInIt
SetTimer("AutoFix", 1000, 1);
Код:
public AutoFix() {
for(new playerid=0; playerid<MAX_PLAYERS; playerid++) {
if(IsPlayerConnected(playerid)) {
new Float:health, cid;
if (IsPlayerInAnyVehicle(playerid)) {
cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (health < 950) {
RepairVehicle(GetPlayerVehicleID(playerid));
}
}
}
}
return 1;
}
can anyone make command /autofix (that players can toggles)
Re: Autofix -
hoodline - 15.06.2011
Код:
new bFix[MAX_PLAYERS];
// AutoFix
public AutoFix() {
for(new playerid=0; playerid<MAX_PLAYERS; playerid++) {
if(IsPlayerConnected(playerid)) {
if(!bFix[playerid]) return 0; // Dont repair the vehicle
new Float:health, cid;
if (IsPlayerInAnyVehicle(playerid)) {
cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (health < 950) {
RepairVehicle(GetPlayerVehicleID(playerid));
}
}
}
}
return 1;
}
// OnPlayerConnect
function OnPlayerConnect(playerid)
{
bFix[playerid] = false;
return 1;
}
// OnPlayerCommandText
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/autofix", cmdtext, true) == 0)
{
if(bFix[playerid])
{
bFix[playerid] = false;
}
else
{
bFix[playerid] = true;
}
return 1;
}
return 1;
}
Re: Autofix -
Cenation - 15.06.2011
thank you so much

...