#include <a_samp> forward TankVerbrauch(playerid); forward Fahrzeuganzeige(playerid); new Float:newX[MAX_PLAYERS], Float:newY[MAX_PLAYERS], Float:newZ[MAX_PLAYERS]; new Float:oldX[MAX_PLAYERS], Float:oldY[MAX_PLAYERS], Float:oldZ[MAX_PLAYERS]; new Float:diffX[MAX_PLAYERS], Float:diffY[MAX_PLAYERS], Float:diffZ[MAX_PLAYERS]; new Float:Num[MAX_PLAYERS]; new FahrzeugID; new Tankinhalt[MAX_VEHICLES]; new GameText; main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } public OnGameModeInit() { SetTimer("TankVerbrauch",5000, true); SetTimer("Fahrzeuganzeige",1000,1); GameText = 0; new Vehicles; for(Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++) { Tankinhalt[Vehicles] = 100; } SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); AddStaticVehicle(581, 1958.3783, 1343.1572, 15.3746, 269.1425,53,1); AddStaticVehicle(581, 1958.3783, 1343.1572, 15.3746, 269.1425,53,1); return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public TankVerbrauch(playerid) { if(GameText == 0) { FahrzeugID = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid)) { Tankinhalt[FahrzeugID] -= 1; } } } public Fahrzeuganzeige(playerid) { for(new i=0; i<MAX_PLAYERS; i++) { new string[256]; FahrzeugID = GetPlayerVehicleID(i); if(IsPlayerInAnyVehicle(playerid) == 1) { GetPlayerPos(playerid, newX[i],newY[i], newZ[i]); diffX[i] = (newX[i]) - (oldX[i]); diffY[i] = (newY[i]) - (oldY[i]); diffZ[i] = (newZ[i]) - (oldZ[i]); Num[i] = floatsqroot((diffX[i] * diffX[i])+(diffY[i] * diffY[i])+(diffZ[i] * diffZ[i])); oldX[i] = newX[i]; oldY[i] = newY[i]; oldZ[i] = newZ[i]; Num[i] = Num[i] * 4; if(Tankinhalt[FahrzeugID] > 0) { if(Tankinhalt[FahrzeugID] < 31) { format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~g~%0.0f/~r~%d", Num[i],Tankinhalt[FahrzeugID]); GameTextForPlayer(i,string,1500,5); } else { format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~g~%0.0f/~g~%d", Num[i],Tankinhalt[FahrzeugID]); GameTextForPlayer(i,string,1500,5); } } else { RemovePlayerFromVehicle(playerid); } } } }
#include <a_samp> forward TankVerbrauch(playerid); forward Fahrzeuganzeige(playerid); new GameText; new Float:newX[MAX_PLAYERS], Float:newY[MAX_PLAYERS], Float:newZ[MAX_PLAYERS]; new Float:oldX[MAX_PLAYERS], Float:oldY[MAX_PLAYERS], Float:oldZ[MAX_PLAYERS]; new Float:diffX[MAX_PLAYERS], Float:diffY[MAX_PLAYERS], Float:diffZ[MAX_PLAYERS]; new Float:Num[MAX_PLAYERS]; new FahrzeugID; new Tankinhalt[MAX_VEHICLES]; #if defined FILTERSCRIPT public OnFilterScriptInit() { SetTimer("TankVerbrauch",5000, true); SetTimer("Fahrzeuganzeige",1000,1); GameText = 0; new Vehicles; for(Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++) { Tankinhalt[Vehicles] = 100; } SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); AddStaticVehicle(581, 1958.3783, 1343.1572, 15.3746, 269.1425,53,1); AddStaticVehicle(581, 1958.3783, 1343.1572, 15.3746, 269.1425,53,1); return 1; } public OnFilterScriptExit() { return 1; } #endif public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public TankVerbrauch(playerid) { if(GameText == 0) { FahrzeugID = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid)) { Tankinhalt[FahrzeugID] -= 1; } } } public Fahrzeuganzeige(playerid) { for(new i=0; i<MAX_PLAYERS; i++) { new string[256]; FahrzeugID = GetPlayerVehicleID(i); if(IsPlayerInAnyVehicle(playerid) == 1) { GetPlayerPos(playerid, newX[i],newY[i], newZ[i]); diffX[i] = (newX[i]) - (oldX[i]); diffY[i] = (newY[i]) - (oldY[i]); diffZ[i] = (newZ[i]) - (oldZ[i]); Num[i] = floatsqroot((diffX[i] * diffX[i])+(diffY[i] * diffY[i])+(diffZ[i] * diffZ[i])); oldX[i] = newX[i]; oldY[i] = newY[i]; oldZ[i] = newZ[i]; Num[i] = Num[i] * 4; if(Tankinhalt[FahrzeugID] > 0) { if(Tankinhalt[FahrzeugID] < 31) { format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~g~%0.0f/~r~%d", Num[i],Tankinhalt[FahrzeugID]); GameTextForPlayer(i,string,1500,5); } else { format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~g~%0.0f/~g~%d", Num[i],Tankinhalt[FahrzeugID]); GameTextForPlayer(i,string,1500,5); } } else { RemovePlayerFromVehicle(playerid); } } } }
Originally Posted by Ignas1337
it doesn't work because you got something wrong, sorry I cannot help you, wait for badger to read this
|
#if defined FILTERSCRIPT
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddStaticVehicle(581, 1958.3783, 1343.1572, 15.3746, 269.1425,53,1);
AddStaticVehicle(581, 1958.3783, 1343.1572, 15.3746, 269.1425,53,1);
public TankVerbrauch(playerid)
public Fahrzeuganzeige(playerid)
#include <a_samp>
forward TankVerbrauch(playerid);
forward Fahrzeuganzeige(playerid);
new GameText;
new Float:newX[MAX_PLAYERS], Float:newY[MAX_PLAYERS], Float:newZ[MAX_PLAYERS];
new Float:oldX[MAX_PLAYERS], Float:oldY[MAX_PLAYERS], Float:oldZ[MAX_PLAYERS];
new Float:diffX[MAX_PLAYERS], Float:diffY[MAX_PLAYERS], Float:diffZ[MAX_PLAYERS];
new Float:Num[MAX_PLAYERS];
new FahrzeugID;
new Tankinhalt[MAX_VEHICLES];
public OnFilterScriptInit()
{
SetTimer("TankVerbrauch",5000, true);
SetTimer("Fahrzeuganzeige",1000,1);
GameText = 0;
new Vehicles;
for(Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
{
Tankinhalt[Vehicles] = 100;
}
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public TankVerbrauch(playerid)
{
if(GameText == 0)
{
FahrzeugID = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
Tankinhalt[FahrzeugID] -= 1;
}
}
return 1;
}
public Fahrzeuganzeige(playerid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new string[256];
FahrzeugID = GetPlayerVehicleID(i);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetPlayerPos(playerid, newX[i],newY[i], newZ[i]);
diffX[i] = (newX[i]) - (oldX[i]); diffY[i] = (newY[i]) - (oldY[i]); diffZ[i] = (newZ[i]) - (oldZ[i]);
Num[i] = floatsqroot((diffX[i] * diffX[i])+(diffY[i] * diffY[i])+(diffZ[i] * diffZ[i]));
oldX[i] = newX[i]; oldY[i] = newY[i]; oldZ[i] = newZ[i];
Num[i] = Num[i] * 4;
if(Tankinhalt[FahrzeugID] > 0)
{
if(Tankinhalt[FahrzeugID] < 31)
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~g~%0.0f/~r~%d", Num[i],Tankinhalt[FahrzeugID]);
GameTextForPlayer(i,string,1500,5);
}
else
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~g~%0.0f/~g~%d", Num[i],Tankinhalt[FahrzeugID]);
GameTextForPlayer(i,string,1500,5);
}
}
else
{
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}