Guten Tag
Ich weiß nicht warum aber folgender Befehl geht nicht:
if(strcmp(cmd, "/freefromcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInFrac(playerid, 21))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
print("55");
SendClientMessage(playerid, COLOR_GREY, "Befehl: /freefromcar [playerid] [Sitz: 0 = hinten links, 1 = hinten rechts]");
return 1;
}
giveplayerid = ReturnUser(tmp);
//if(!IsAWheelman(giveplayerid)) return SendClientMessage(playerid, COLOR_GRAD2, "Dieser Spieler ist kein Gang-mitglied.");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != playerid)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
print("44");
SendClientMessage(playerid, COLOR_GREY, "Befehl: /freefromcar [playerid] [Sitz: 0 = hinten links, 1 = hinten rechts]");
return 1;
}
new sit = strval(tmp);
if(sit < 0 || sit > 1)
{
SendClientMessage(playerid, COLOR_GREY, "Wähle den Sitzplatz nicht unter 0 oder über 1!");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, COLOR_GREY, "Du bist nicht der Fahrer dieses Fahrzeuges!");
return 1;
}
if(GetDistanceBetweenPlayers(playerid, giveplayerid) < 10)
{
new member = 0;
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pMember] == PlayerInfo[playerid][pMember] || PlayerInfo[i][pLeader] == PlayerInfo[playerid][pMember]
|| PlayerInfo[i][pLeader] == PlayerInfo[playerid][pLeader])
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
print("1222");
member ++;
}
}
}
if(member >= 2)
{
if(GetDistanceBetweenPlayers(playerid, giveplayerid) < 10)
{
if(IsPlayerInAnyVehicle(giveplayerid))
{
//new car = GetPlayerVehicleID(playerid);
if(sit == 0)
{
new giveplayerx[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayerx, sizeof(giveplayerx));
SetTimerEx("FreeFromCar1", 10000, 0, "i", playerid);
SendClientMessage(playerid, HBLAU, "Bleib 10 Sekunden an ihm dran um ihn aus dem Car zu ziehen!");
format(string, sizeof(string), "** Ein Wheelman versucht %s aus dem Auto zu ziehen!", giveplayerx);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(sit == 1)
{
new giveplayerx[MAX_PLAYER_NAME];
print("1");
GetPlayerName(giveplayerid, giveplayerx, sizeof(giveplayerx));
print("2");
SetTimerEx("FreeFromCar2", 10000, 0, "i", playerid);
print("3");
SendClientMessage(playerid, HBLAU, "Bleib 10 Sekunden an ihm dran um ihn aus dem Car zu ziehen!");
print("4");
format(string, sizeof(string), "** Ein Wheelman versucht %s aus dem Auto zu ziehen!", giveplayerx);
print("5");
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
print("6");
}
// format(string, sizeof(string), "ACHTUNG: %s wurde von %s gekidnapped.",giveplayer,sendername);
for(new g=0;g<MAX_PLAYERS; g++)
{
if(IsPlayerInFrac(playerid, 21))
{
// SendClientMessage(g, COLOR_GRAD2, string);
}
}
}
}
}
}
}
}
}
}
return 1;
}
Zwar kommt Befehl: Befehl: /freefromcar [playerid] [Sitz: 0 = hinten links, 1 = hinten rechts]
aber der Mittelteil kommt nicht ab
new giveplayerx[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayerx, sizeof(giveplayerx));
SetTimerEx("FreeFromCar1", 10000, 0, "i", playerid);
SendClientMessage(playerid, HBLAU, "Bleib 10 Sekunden an ihm dran um ihn aus dem Car zu ziehen!");
format(string, sizeof(string), "** Ein Wheelman versucht %s aus dem Auto zu ziehen!", giveplayerx);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
habe auch mal print("1"); gemacht an der stelle funktioniert nicht
Die Functions:
Function FreeFromCar1(playerid, giveplayerid, giveplayer)
{
if(GetDistanceBetweenPlayers(playerid, giveplayerid) < 3)
{
new string[256], string2[256];
new car = GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(giveplayerid);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid,X,Y,Z);
SetPlayerPos(giveplayerid,X,Y,Z+5);
format(string,sizeof(string),"* Du hast %s erfolgreich auf den Sitzplatz 0 gezogen !",giveplayer);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
format(string2, sizeof(string2), "** Ein Wheelman hat es geschafft, %s aus dem Auto zu zerren.", giveplayer);
ProxDetector(30.0, playerid, string2, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
FreezePlayer(giveplayerid);
PlayerTied[giveplayerid] = 1;
PutPlayerInVehicle(giveplayerid, car, 2);
GameTextForPlayer(playerid, "Befreiung läuft...", 5000, 3);
SetTimerEx("Befreiung1", 10000, 0, "i", playerid);
}
else
{
SendClientMessage(playerid, HBLAU, "Du hast es nicht geschafft den Spieler zu befreien!");
}
}
Function Befreiung1(playerid, giveplayerid)
{
if(IsPlayerInAnyVehicle(giveplayerid))
{
UnFreezePlayer(giveplayerid);
PlayerTied[giveplayerid] = 0;
GameTextForPlayer(playerid, "Befreiung erfolgreich.", 1950, 3);
SendClientMessage(giveplayerid, HBLAU, "Du wurdest erfolgreich von einem Wheelman befreit.");
}
else
{
SendClientMessage(playerid, DROT, "Befreiung gescheitert. Der Spieler hat dein Fahrzeug verlassen.");
}
}
Function FreeFromCar2(playerid, giveplayerid, giveplayer)
{
if(GetDistanceBetweenPlayers(playerid, giveplayerid) < 3)
{
new string[256], string2[256];
new car = GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(giveplayerid);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid,X,Y,Z);
SetPlayerPos(giveplayerid,X,Y,Z+5);
format(string,sizeof(string),"* Du hast %s erfolgreich auf den Sitzplatz 1 gezogen !",giveplayer);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
format(string2, sizeof(string2), "** Ein Wheelman hat es geschafft, %s aus dem Auto zu zerren.", giveplayer);
ProxDetector(30.0, playerid, string2, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
FreezePlayer(giveplayerid);
PlayerTied[giveplayerid] = 1;
PutPlayerInVehicle(giveplayerid, car, 3);
GameTextForPlayer(playerid, "Befreiung läuft...", 5000, 3);
SetTimerEx("Befreiung1", 10000, 0, "i", playerid);
}
else
{
SendClientMessage(playerid, HBLAU, "Du hast es nicht geschafft den Spieler zu befreien!");
}
}