new vutimer[MAX_PLAYERS];
forward VUTimer(playerid);
forward Retten(playerid, otherplayer);
forward Float:GetDistanceBetweenPlayers(p1,p2);
public VUTimer(playerid)
{
new Float:health;
new string[256];
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleHealth(vehicleid, health);
format(string, 256, "~n~~n~~n~~n~~n~~n~~g~Auto Schaden : ~w~%.0f",health);
GameTextForPlayer(playerid, string, 2000, 5);
}
new VID, Float:h_vid;
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
VID = GetPlayerVehicleID(playerid);
GetVehicleHealth(VID, h_vid);
if(h_vid <= 350)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, 0xFF6900AA, "Du bist eingeklemmt. Rufe die Feuerwehr mit /service feuerwehr.");
SetVehicleHealth(vehicleid, 375.0);
SetPlayerHealth(playerid,100);
}
}
return 1;
}
public Retten(playerid, otherplayer)
{
new giveplayer[200];
new sendername[MAX_PLAYERS];
GetPlayerName(otherplayer, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new Float:X;
new Float:Y;
new Float:Z;
new string[256];
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(otherplayer,X,Y+1,Z);
format(string, sizeof(string), "Du hast %s gerettet!", giveplayer);
SendClientMessage(playerid,COLOR_WHITE, string);
format(string, sizeof(string), "Du wurdest von %s gerettet", sendername);
SendClientMessage(otherplayer,COLOR_WHITE, string);
TogglePlayerControllable(playerid, 1);
TogglePlayerControllable(otherplayer, 1);
}
if(strcmp(cmd, "/befreien", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[BENUTZUNG]: /befreien [SpielerID]");
return 1;
}
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Falsche SpielerID !");
if(GetDistanceBetweenPlayers(playerid,otherplayer) <= 5.0)
{
SetTimerEx("Retten", 15000, false, "ii", playerid, otherplayer);
SendClientMessage(playerid, COLOR_WHITE, "Der Spieler wird befreit. Es dauert 15 Sekunden.");
SendClientMessage(otherplayer, COLOR_WHITE, "Du wirst nun fachmännisch befreit. Halte durch.");
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Der Spieler ist zu weit von dir entfernt !");
}
}
else
{
if(PlayerInfo[playerid][pJob] == 112)
{
if(ffduty[playerid] == 1)
{
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[BENUTZUNG]: /befreien [SpielerID]");
return 1;
}
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Falsche SpielerID !");
if(GetDistanceBetweenPlayers(playerid,otherplayer <= 5.0))
{
SetTimerEx("Retten", 15000, false, "ii", playerid, otherplayer);
SendClientMessage(playerid, COLOR_YELLOW, "Der Spieler wird befreit. Es dauert 15 Sekunden.");
SendClientMessage(otherplayer, COLOR_YELLOW, "Du wirst nun fachmännisch befreit. Halte durch.");
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Der Spieler ist zu weit von dir entfernt !");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht im Dienst.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht beim SAFD/bei der freiwilligen Feuerwehr");
}
}
}
return 1;
}
Im OnGameModeInit:
SetTimer("VUTimer", 1000, 1);
Problem: Nur ID 0 wird eingeklemmt.
Ich hoffe, ihr könnt mir helfen. MfG
Edit: Im Script ist das ordentlicher eingerückt..