#define FILTERSCRIPT #define COLOR_LIGHTBLUE 0x0080FFFF #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) #define IsPlayerNotInVehicle(%0) (!IsPlayerInAnyVehicle(%0)) #include <a_samp> #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Car Fix by pressing 2 to fix your car."); print("--------------------------------------\n"); return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(PRESSED(KEY_SUBMISSION)) { new vehicleid = GetPlayerVehicleID(playerid); if(IsPlayerInVehicle(playerid, vehicleid)) { SetVehicleHealth(vehicleid,1000.0); RepairVehicle(GetPlayerVehicleID(playerid)); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have successfully repaired your car!"); } } if(PRESSED(KEY_ACTION)) { if(IsPlayerNotInVehicle(playerid)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have to be in a car to be able to repair your car!"); } } } #endif
#include <a_samp> #define CZERWONY 0xFF0000FF #define ZIELONY 0x00FF00FF public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid)) { new currentveh; // flip new Float:angle; // flip currentveh = GetPlayerVehicleID(playerid); // flip GetVehicleZAngle(currentveh, angle); // flip SetVehicleZAngle(currentveh, angle); // flip SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0); RepairVehicle(GetPlayerVehicleID(playerid)); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); return 1; } return 1; }
#include <a_samp>
#define CZERWONY 0xFF0000FF
#define ZIELONY 0x00FF00FF
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
new currentveh; // flip
new Float:angle; // flip
currentveh = GetPlayerVehicleID(playerid); // flip
GetVehicleZAngle(currentveh, angle); // flip
SetVehicleZAngle(currentveh, angle); // flip
SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
return 1;
}
return 1;
}
#include <a_samp>
#define CZERWONY 0xFF0000FF
#define ZIELONY 0x00FF00FF
forward RepairVehicle(playerid);
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
SetTimerEx("RVehicle", 1000, 60000, "i", playerid);
return 1;
}
return 1;
}
public RVehicle(playerid)
{
new currentveh; // flip
new Float:angle; // flip
currentveh = GetPlayerVehicleID(playerid); // flip
GetVehicleZAngle(currentveh, angle); // flip
SetVehicleZAngle(currentveh, angle); // flip
SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
return 1;
}
rvehicle.pwn(6) : error 021: symbol already defined: "RepairVehicle" rvehicle.pwn(18) : warning 235: public function lacks forward declaration (symbol "RVehicle") 1 Error.
public OnGameModeInit() //or OnFilterScriptInit if its a filterscript
{
SetTimer("RepairCars", 60000, true); //We set a timer that will call the function "RepairCars" every 60000ms (~60 sec)
}
forward RepairCars();
public RepairCars() //This is the function that the timer will call
{
for(new i; i < MAX_PLAYERS; i++) //You can also use foreach, its faster and more effective :)
{
if(!IsPlayerConnected(i)) continue; //Ignores players that aren't connected
if(GetPlayerVehicleSeat(i) != 0) continue; //Ignores players that aren't in the driver seat
//Now we can repair the car...
SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
RepairVehicle(GetPlayerVehicleID(i));
}
}
#include <a_samp>
#define CZERWONY 0xFF0000FF
#define ZIELONY 0x00FF00FF
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
SetTimerEx("RVehicle", 1000, 60000, "i", playerid);
return 1;
}
return 1;
}
forward RVehicle(playerid);
public RVehicle(playerid)
{
new currentveh; // flip
new Float:angle; // flip
currentveh = GetPlayerVehicleID(playerid); // flip
GetVehicleZAngle(currentveh, angle); // flip
SetVehicleZAngle(currentveh, angle); // flip
SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
return 1;
}
pawn Код:
|
SetTimerEx("RVehicle", 1000, 60000, "i", playerid);
SetTimerEx("RVehicle", 1000, false, "i", playerid);
#include <a_samp> public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid)) { SetTimerEx("RVehicle", 20000, false, "i", playerid); return 1; } return 1; } forward RVehicle(playerid); public RVehicle(playerid) { new currentveh; // flip new Float:angle; // flip currentveh = GetPlayerVehicleID(playerid); // flip GetVehicleZAngle(currentveh, angle); // flip SetVehicleZAngle(currentveh, angle); // flip SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0); RepairVehicle(GetPlayerVehicleID(playerid)); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); return 1; }
#include <a_samp>
new LastRepair[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SUBMISSION && !GetPlayerVehicleSeat(playerid))
{
if((gettime()-LastRepair[playerid]) < 20)
{
//Here you can send a message saying that you need to wait before repairing again or whatever you want
return 1;
}
LastRepair[playerid] = gettime();
new currentveh; // flip
new Float:angle; // flip
currentveh = GetPlayerVehicleID(playerid); // flip
GetVehicleZAngle(currentveh, angle); // flip
SetVehicleZAngle(currentveh, angle); // flip
SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
}
return 1;
}