Hallo,
ich habe meinen alten Befehl /flash (Funktion: z.B. Bei FBI Fahrzeugen wird ||| F.B.I. ||| rot-blau blinkend angezeigt) verbessert, sprich Bugs ausgemärzt und diesen Befehl für andere Fraktionen erweitert.
Seitdem blinkt jenachdem wieviele User auf dem Server online sind dieser Effekt falsch, also schneller als Normal, natürlich verwende ich Timer, aber die bringen nur was, wenn sogut wie keiner online ist auf dem SA:MP Server.
Hier mal der gesamte Befehl.
Der Command selbst:
if(strcmp(cmd, "/flash", true) == 0)
{
if(IsAFBI(playerid))
{
if(flashonoff[playerid]==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new autofbi = GetPlayerVehicleID(playerid);
fbi1[playerid] = Create3DTextLabel("||| F.B.I. |||",0xFF000FFF,30.0,30.0,5.0,30.0,0);
Attach3DTextLabelToVehicle(fbi1[playerid], autofbi, 0.0, 0.0, 0.0);
flashonoff[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du bist in keinem Fahrzeug!");
}
}
else
{
Delete3DTextLabel(fbi1[playerid]);
flashonoff[playerid] = 0;
}
}
if(IsAARMY(playerid))
{
if(armyflashonoff[playerid]==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new autoarmy = GetPlayerVehicleID(playerid);
army1[playerid] = Create3DTextLabel("||||||||||\nU.S. Army\n||||||||||",0x6E8B3DFF,30.0,30.0,5.0,30.0,0);
Attach3DTextLabelToVehicle(army1[playerid], autoarmy, 0.0, 0.0, 0.0);
armyflashonoff[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du bist in keinem Fahrzeug!");
}
}
else
{
Delete3DTextLabel(army1[playerid]);
armyflashonoff[playerid] = 0;
}
}
if(IsAFS(playerid))
{
if(fsflashonoff[playerid]==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsAFSCar(GetPlayerVehicleID(playerid)))
{
new autofs = GetPlayerVehicleID(playerid);
fs1[playerid] = Create3DTextLabel("Fahrschule\n||||||||||\nNicht stören!",0xFFFFFFFF,30.0,30.0,5.0,30.0,0);
Attach3DTextLabelToVehicle(fs1[playerid], autofs, 0.0, 0.0, 0.0);
fsflashonoff[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du bist nicht in einem Fahrschul Fahrzeug!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du bist in keinem Fahrzeug!");
}
}
else
{
Delete3DTextLabel(fs1[playerid]);
fsflashonoff[playerid] = 0;
}
}
return 1;
}
Die public's, die den blinkenden Effekt herbeiführen sollen:
public Check(playerid)
{
if(flashonoff[playerid]==1)
{
if(checkfarben[playerid] == 0)
{
Update3DTextLabelText(fbi1[playerid],0xFF000FFF,"||| F.B.I. |||"); checkfarben[playerid] = 1;
}
else if(checkfarben[playerid] == 1)
{
Update3DTextLabelText(fbi1[playerid],0x0000CDFF,"||| F.B.I. |||"); checkfarben[playerid] = 0;
}
}
return 1;
}
public armyCheck(playerid)
{
if(armyflashonoff[playerid]==1)
{
if(armycheckfarben[playerid] == 0)
{
Update3DTextLabelText(army1[playerid],0x6E8B3DFF,"||||||||||\nU.S. Army\n||||||||||"); armycheckfarben[playerid] = 1;
}
else if(armycheckfarben[playerid] == 1)
{
Update3DTextLabelText(army1[playerid],0x8B5A2BFF,"||||||||||\nU.S. Army\n||||||||||"); armycheckfarben[playerid] = 0;
}
}
return 1;
}
public fsCheck(playerid)
{
if(fsflashonoff[playerid]==1)
{
if(fscheckfarben[playerid] == 0)
{
Update3DTextLabelText(fs1[playerid],0xFFFFFFFF,"Fahrschule\n||||||||||\nNicht stören!"); fscheckfarben[playerid] = 1;
}
else if(fscheckfarben[playerid] == 1)
{
Update3DTextLabelText(fs1[playerid],0xEEDD82FF,"Fahrschule\n||||||||||\nNicht stören!"); fscheckfarben[playerid] = 0;
}
}
return 1;
}
Die Timer, die die public's aufrufen sollen:
public OnPlayerConnect(playerid)
{
SetTimerEx("Check", 1000, 1, "i", playerid);
SetTimerEx("armyCheck", 1000, 1, "i", playerid);
SetTimerEx("fsCheck", 1000, 1, "i", playerid);
}
Und noch die ganzen Definierungen (new und forward):
new Text3D:fbi1[MAX_PLAYERS];
new Text3D:army1[MAX_PLAYERS];
new Text3D:fs1[MAX_PLAYERS];
new checkfarben[MAX_PLAYERS] = 0;
new armycheckfarben[MAX_PLAYERS] = 0;
new fscheckfarben[MAX_PLAYERS] = 0;
forward Check(playerid);
forward armyCheck(playerid);
forward fsCheck(playerid);
Vielleicht kann mir ja jemand helfen.
MfG