Ich habe Fraktionen anhand gTeam erstellt, alles ist ja gut. Dann wollte ich machen, dass wenn man in ein Copcar einsteigt, da steht "Du bist kein Polizist" o.ä. und dass wenn man on duty will auch in einem Copcar sein muss. Ich habe hier im Forum folgende seite gefunden: Klick mich
Ich habe es folgender massen gemacht:
/*------------[Fraktionsautos]------------*/
#define MAX_COP_CARS 41
new CopCar[MAX_COP_CARS];
new IstOnDuty[MAX_PLAYERS];
public OnGameModeInit()
{
//Cars
CopCar[0] = AddStaticVehicleEx(497,1565.6211,-1650.1439,28.5277,90.2339,0,1,0); // SAPD Heli 1
CopCar[1] = AddStaticVehicleEx(497,1567.3485,-1694.0725,28.5707,87.4758,0,1,0); // SAPD Heli 2
CopCar[2] = AddStaticVehicleEx(523,1557.7211,-1692.0454,5.4599,178.0054,1,0,0); // Copbike 3
CopCar[3] = AddStaticVehicleEx(523,1559.3000,-1692.1698,5.4612,178.6237,1,0,0); // Copbike2 4
CopCar[4] = AddStaticVehicleEx(523,1560.7941,-1692.2902,5.4638,176.5187,1,0,0); // Copbike3 5
CopCar[5] = AddStaticVehicleEx(523,1562.3784,-1692.3898,5.4611,178.5868,1,0,0); // Copbike4 6
CopCar[6] = AddStaticVehicleEx(523,1557.7946,-1695.9326,5.4615,180.0531,1,0,0); // Copbike5 7
CopCar[7] = AddStaticVehicleEx(523,1559.2336,-1696.1057,5.4673,177.9614,1,0,0); // Copbike6 8
CopCar[8] = AddStaticVehicleEx(523,1560.9214,-1696.1858,5.4676,182.4560,1,0,0); // Copbike7 9
CopCar[9] = AddStaticVehicleEx(523,1562.6245,-1696.4015,5.4628,182.9460,1,0,0); // Copbike8 10
CopCar[10] = AddStaticVehicleEx(596,1528.1454,-1688.0558,5.6118,269.1839,0,1,0); // LSPD Leadercar 11
CopCar[11] = AddStaticVehicleEx(596,1528.1931,-1683.8894,5.6115,269.7263,0,1,0); // LSPD Leadercar 12
CopCar[12] = AddStaticVehicleEx(596,1558.7604,-1711.4849,5.6122,359.8857,0,1,0); // LSPD Copcar 13
CopCar[13] = AddStaticVehicleEx(596,1562.7842,-1711.5857,5.6138,359.8131,0,1,0); // LSPD Copcar2 14
CopCar[14] = AddStaticVehicleEx(596,1566.4919,-1711.5056,5.6111,0.4639,0,1,0); // LSPD Copcar3 15
CopCar[15] = AddStaticVehicleEx(596,1570.3409,-1711.4833,5.6107,0.2204,0,1,-0); // LSPD Copcar4 16
CopCar[16] = AddStaticVehicleEx(596,1574.5134,-1711.3556,5.6122,0.6724,0,1,0); // LSPD Copcar5
//.. und so weiter
public OnPlayerCommandText
// darunter hab ich folgendes:
if(strcmp("/duty", cmdtext, true) == 0)
{
if(IstOnDuty[playerid] == 0)
{
if(gTeam[playerid] == TEAM_ARMY)
{
for(new c=0;c<MAX_COP_CARS;c++)
for(new a=0;a<MAX_ARMY_CARS;a++)
for(new s=0;s<MAX_SWAT_CARS;s++)
{
if(IsPlayerInVehicle(playerid,CopCar[code=c]) || IsPlayerInVehicle(playerid,ArmyCar[a]) || IsPlayerInVehicle(playerid,SWATCar[s]))
{
new aname[MAX_PLAYER_NAME], astring[48];
GetPlayerName(playerid, aname, sizeof(aname));
format(astring, sizeof(astring), "Soldat %s ist im Dienst.", aname );
SendDistancedClientMessage(playerid, 40,astring, 0x800080AA,0x800080AA,0x800080AA,0x800080AA,0x800080AA);
SetPlayerColor(playerid, 0x33AA33AA);
SetPlayerArmour(playerid, 100.0);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 29, 500);
GivePlayerWeapon(playerid, 31, 500);
IstOnDuty[playerid] = 1;
}else{
SCM(playerid, GREY, "Du bist nicht in deinem Dienstwagen!");
}
}
}
else if(gTeam[playerid] == TEAM_COPS)
{
for(new c=0;c<MAX_COP_CARS;c++)
for(new a=0;a<MAX_ARMY_CARS;a++)
for(new s=0;s<MAX_SWAT_CARS;s++)
{
if(IsPlayerInVehicle(playerid,CopCar[code=c]))
{
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Polizist %s ist im Dienst.", name );
SendDistancedClientMessage(playerid, 40,string, 0x800080AA,0x800080AA,0x800080AA,0x800080AA,0x800080AA);
SetPlayerColor(playerid, BLUE);
SetPlayerArmour(playerid, 100.0);
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 41, 500);
GivePlayerWeapon(playerid,3, 1);
IstOnDuty[playerid] = 1;
}else{
SCM(playerid, GREY, "Du bist nicht in deinem Dienstwagen!");
}
}
}
else if(gTeam[playerid] == TEAM_SWAT)
{
for(new c=0;c<MAX_COP_CARS;c++)
{
if(IsPlayerInVehicle(playerid,CopCar[code=c]))
{
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "SWAT Mitglied %s ist im Dienst.", name );
SendDistancedClientMessage(playerid, 40,string, 0x800080AA,0x800080AA,0x800080AA,0x800080AA,0x800080AA);
SetPlayerColor(playerid,COLOUR_BLUE);
SetPlayerArmour(playerid, 100.0);
GivePlayerWeapon(playerid, 29, 200);
GivePlayerWeapon(playerid, 30, 200);
GivePlayerWeapon(playerid,31, 100);
GivePlayerWeapon(playerid,34, 50);
IstOnDuty[playerid] = 1;
}else{
SCM(playerid, GREY, "Du bist nicht in deinem Dienstwagen!");
}
}
}
else
{
GameTextForPlayer(playerid,"Du bist kein Soldat/Cop/S.W.A.T. Mitglied!",1000,1);
}
}
else if(IstOnDuty[playerid] == 1)
{
if(gTeam[playerid] == TEAM_ARMY)
{
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Soldat %s macht Feierabend.", name );
SendDistancedClientMessage(playerid, 40,string, 0x800080AA,0x800080AA,0x800080AA,0x800080AA,0x800080AA);
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerArmour(playerid, 0);
ResetPlayerWeapons(playerid);
IstOnDuty[playerid] = 0;
}
else if(gTeam[playerid] == TEAM_COPS)
{
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Polizist %s macht Feierabend.", name );
SendDistancedClientMessage(playerid, 40,string, 0x800080AA,0x800080AA,0x800080AA,0x800080AA,0x800080AA);
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerArmour(playerid, 0);
ResetPlayerWeapons(playerid);
IstOnDuty[playerid] = 0;
}
else if(gTeam[playerid] == TEAM_SWAT)
{
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "SWAT Mitglied %s macht Feierabend.", name );
SendDistancedClientMessage(playerid, 40,string, 0x800080AA,0x800080AA,0x800080AA,0x800080AA,0x800080AA);
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerArmour(playerid, 0);
ResetPlayerWeapons(playerid);
IstOnDuty[playerid] = 0;
}
else
{
GameTextForPlayer(playerid,"Du bist kein Soldat/Cop/S.W.A.T. Mitglied!",1000,1);
}
}
}
//nun noch wenn man in ein copcar einsteigen will:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
for(new c=0;c<MAX_COP_CARS;c++)
for(new a=0;a<MAX_ARMY_CARS;a++)
for(new s=0;s<MAX_SWAT_CARS;s++)
if(vehicleid == CopCar[code=c] || vehicleid == ArmyCar[a] || vehicleid == SWATCar[s])
{
if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_SWAT || gTeam[playerid] == TEAM_ARMY)
{
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, GREY, "Du bist kein Polizist/Soldat/S.W.A.T. Mitglied!");
}
}
}
}
Wenn ich diese Sachen mache sieht es so aus:
Nun hier wenn ein nicht Cop in ein Copfahrzeug einsteigt:
Hier wenn man on duty will:
Es spammt alles voll!
Und bei jedem Befehl den ich mache kommt noch "Server: Unknow command."
Bitte helft mir.