30.06.2014, 23:33
My server is auto fixing the car automaticly, So i made a derby minigame and i want the car not to fix, when i join it the car is fixed automaticly, how to disable it in derby, what to do
if(strcmp(cmd, "/derby", true) == 0) { if(derbyplaying == 1) { SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started"); return 1; } if(playerinminigame[playerid] == 1) { SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame"); return 1; } new pname[256]; GetPlayerName(playerid, pname, 256); if(derbyon == 0) { derbyon = 1; playerinminigame[playerid] = 1; playerinderby[playerid] = 1; derbyrank = 1; SetPlayerInterior(playerid,15); SetPlayerVirtualWorld(playerid,7); SetVehicleVirtualWorld(bloodring[0],7); bloodringfull[0] = 1; PutPlayerInVehicle(playerid, bloodring[0], 0); playerinbloodring[playerid] = 0; TogglePlayerControllable(playerid, 0); startvar[0] = 1; dtimer = SetTimer("StartDerby", 60000, 0); format(string, sizeof(string), "%s has started a derby, you have one minute to type /derby and join", pname);// SendClientMessageToAll(0x33AA33AA,string); return 1; } else if(derbyon == 1 && derbyrank < 15) { playerinminigame[playerid] = 1; playerinderby[playerid] = 1; derbyrank++; SetPlayerInterior(playerid,15); for(new i=0; i<15; i++) { if(bloodringfull[i] == 0) { SetPlayerVirtualWorld(playerid,7); SetVehicleVirtualWorld(bloodring[i],7); bloodringfull[i] = 1; PutPlayerInVehicle(playerid, bloodring[i], 0); TogglePlayerControllable(playerid, 0); playerinbloodring[playerid] = i; format(string, sizeof(string), "%s has joined the derby", pname);// SendClientMessageToAll(0x33AA33AA,string); return 1; } } } else if(derbyon == 1 && derbyrank >= 15) { format(string, sizeof(string), "The derby is full, wait for the next round", pname);// SendClientMessage(playerid,0x33AA33AA,string); return 1; } }
public FixAllCar() { for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) // loop all possible player { if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid) && AutoFix[playerid] == 1) //if the player is connected AND in a car { new vehicleid = GetPlayerVehicleID(playerid);// gettin the vehicle id SetVehicleHealth(vehicleid,1000.0);// set the vehicle health } } } public OnVehicleDamageStatusUpdate(vehicleid, playerid) { #pragma unused playerid if (AutoFix[playerid] == 1) { new panels, doors, lights, tires; GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires); tires = encode_tires(0, 0, 0, 0); // fix all tires panels = encode_panels(0, 0, 0, 0, 0, 0, 0); // fix all panels //fell off - (3, 3, 3, 3, 3, 3, 3) doors = encode_doors(0, 0, 0, 0, 0, 0); // fix all doors //fell off - (4, 4, 4, 4, 0, 0) lights = encode_lights(0, 0, 0, 0); // fix all lights UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires); } return 1; }
if(strcmp(cmd, "/derby", true) == 0)
{
if(derbyplaying == 1)
{
SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
return 1;
}
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
return 1;
}
new pname[256];
GetPlayerName(playerid, pname, 256);
if(derbyon == 0)
{
derbyon = 1;
playerinminigame[playerid] = 1;
playerinderby[playerid] = 1;
derbyrank = 1;
AutoFix[playerid] == 0
SetPlayerInterior(playerid,15);
SetPlayerVirtualWorld(playerid,7);
SetVehicleVirtualWorld(bloodring[0],7);
bloodringfull[0] = 1;
PutPlayerInVehicle(playerid, bloodring[0], 0);
playerinbloodring[playerid] = 0;
TogglePlayerControllable(playerid, 0);
startvar[0] = 1;
dtimer = SetTimer("StartDerby", 60000, 0);
format(string, sizeof(string), "%s has started a derby, you have one minute to type /derby and join", pname);//
SendClientMessageToAll(0x33AA33AA,string);
return 1;
} else if(derbyon == 1 && derbyrank < 15) {
playerinminigame[playerid] = 1;
playerinderby[playerid] = 1;
AutoFix[playerid] == 0
derbyrank++;
SetPlayerInterior(playerid,15);
for(new i=0; i<15; i++)
{
if(bloodringfull[i] == 0)
{
SetPlayerVirtualWorld(playerid,7);
SetVehicleVirtualWorld(bloodring[i],7);
bloodringfull[i] = 1;
PutPlayerInVehicle(playerid, bloodring[i], 0);
TogglePlayerControllable(playerid, 0);
playerinbloodring[playerid] = i;
format(string, sizeof(string), "%s has joined the derby", pname);//
SendClientMessageToAll(0x33AA33AA,string);
return 1;
}
}
} else if(derbyon == 1 && derbyrank >= 15) {
format(string, sizeof(string), "The derby is full, wait for the next round", pname);//
SendClientMessage(playerid,0x33AA33AA,string);
return 1;
}
}
pawn Код:
|
AutoFix[playerid] == 0?
public FixAllCar()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
// loop all possible player
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid) && AutoFix[playerid] == 1 && playerinminigame[playerid] == 0 && playerinderby[playerid] == 0)
//if the player is connected AND in a car And yea, not inside a minigame nor in a derby :C
{
new vehicleid = GetPlayerVehicleID(playerid);// gettin the vehicle id
SetVehicleHealth(vehicleid,1000.0);// set the vehicle health
}
}
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
#pragma unused playerid
if (AutoFix[playerid] == 1 && playerinminigame[playerid] == 0 && playerinderby[playerid] == 0)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
tires = encode_tires(0, 0, 0, 0); // fix all tires
panels = encode_panels(0, 0, 0, 0, 0, 0, 0); // fix all panels //fell off - (3, 3, 3, 3, 3, 3, 3)
doors = encode_doors(0, 0, 0, 0, 0, 0); // fix all doors //fell off - (4, 4, 4, 4, 0, 0)
lights = encode_lights(0, 0, 0, 0); // fix all lights
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
}
return 1;
}