//========Includes=============================================
#include <a_samp>
//Created By Loyal (c) All right Reserved
//=========forward===========================================================
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward Startup(playerid, vehicleid);
//========Colors=========================================================
#define COLOR_RED 0xCC0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x33FF00AA
#define COLOR_CYAN 0x33FFFFAA
#define COLOR_BLUE 0x0000FFAA
#define COLOR_ORANGE 0xFFCC00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLACK 0x000000AA
#define COLOR_GREY 0xCCCCCCAA
//========="new"==========================================================================
new sendername[MAX_PLAYER_NAME];
new BigEar[MAX_PLAYERS];
new engineOn[MAX_VEHICLES];
new vehicleEntered[MAX_PLAYERS][MAX_VEHICLES];
//==========Rest==============================================================================
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Engine Filterscript By Loyal");
print("--------------------------------------\n");
return true;
}
public OnFilterScriptExit()
{
return true;
}
#else
#endif
public OnPlayerRequestClass(playerid, classid)
{
return true;
}
public OnPlayerRequestSpawn(playerid)
{
return true;
}
public OnPlayerConnect(playerid)
{
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
return true;
}
public OnPlayerSpawn(playerid)
{
return true;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && (pveh == 522 || pveh == 581 || pveh == 462 || pveh == 521 || pveh == 463 || pveh == 461 || pveh == 448 || pveh == 471 || pveh == 468 || pveh == 586) && (pveh != 509 && pveh != 481 && pveh != 510))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
}
else if(newstate == PLAYER_STATE_DRIVER)
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
}
return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
new string[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/Startcar", true))
{
if(engineOn[GetPlayerVehicleID(playerid)]) return SendClientMessage(playerid, COLOR_RED, "Engine already started!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Do you think that you can start an engine which you don't have?");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "Only the driver can do this!");
engineOn[GetPlayerVehicleID(playerid)] = true;
TogglePlayerControllable(playerid, true);
new playerveh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerid, playerveh, 0);
SendClientMessage(playerid, COLOR_GREEN, "Engine started!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s starts the Engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return true;
}
if(!strcmp(cmd, "/getoff", true))
{
if(engineOn[GetPlayerVehicleID(playerid)]) return SendClientMessage(playerid, COLOR_RED, "this command is used for when the engine is off!!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "What are you getting off?");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "Only the driver can do this!");
engineOn[GetPlayerVehicleID(playerid)] = false;
TogglePlayerControllable(playerid, true);
RemovePlayerFromVehicle(playerid);
new playerveh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerid, playerveh, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s gets out of his vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return true;
}
if(!strcmp(cmd, "/Stopcar", true))
{
if(!engineOn[GetPlayerVehicleID(playerid)]) return SendClientMessage(playerid, COLOR_RED, "Engine not started!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Do you think that you can start an engine which you don't have?");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "Only the driver can do this!");
engineOn[GetPlayerVehicleID(playerid)] = false;
TogglePlayerControllable(playerid, false);
SendClientMessage(playerid, COLOR_GREEN, "Engine stopped!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s switches off the Engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return true;
}
return false;
}
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!BigEar[i])
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
}
return 1;
}
public Startup(playerid, vehicleid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER || engineOn[vehicleid])
{
}
else if(!engineOn[vehicleid] && !vehicleEntered[playerid][vehicleid] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, COLOR_YELLOW, "/startcar to start your engine!");
TogglePlayerControllable(playerid, false);
vehicleEntered[playerid][vehicleid] = true;
}
else if(!engineOn[vehicleid] && vehicleEntered[playerid][vehicleid] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, COLOR_YELLOW, "/startcar to start your engine!");
TogglePlayerControllable(playerid, false);
}
}
strtok(const string[], &index, const seperator[] = " ")
{
new index2, result[30];
index2 = strfind(string, seperator, false, index);
if(index2 == -1)
{
if(strlen(string) > index)
{
strmid(result, string, index, strlen(string), 30);
index = strlen(string);
}
return result;
}
if(index2 > (index + 29))
{
index2 = index + 29;
strmid(result, string, index, index2, 30);
index = index2;
return result;
}
strmid(result, string, index, index2, 30);
index = index2 + 1;
return result;
}
wie kann man dan so machen das nur derjenige der das auto startet den text lesen kann im mom kann das noch jeder sehen
&
kann das wer ändern das wenn mann den motor ausmacht das mann den auch austeigen kann