habe jetzt hier mal geschrieben !
PHP
if(strcmp(cmd,"/sellcar",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid,COLOR_GREY," Du bist noch nicht level 2");
return 1;
}
if(Carlist[playerid][CarKey[playerid]][Typ] == -1)
{
SendClientMessage(playerid,COLOR_GREY," Dies ist nicht dein Auto");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Benutze: /sellcar [playerid] [Preis]");
return 1;
}
//giveplayerid = strval(tmp);
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Benutze: /sellcar [playerid] [Preis]");
return 1;
}
new money = strval(tmp);
if(money < 1 || money > 1000000000) { SendClientMessage(playerid, COLOR_GREY, " Preis musst zwisch 1 und 1mrd Dollar liegen !"); return 1; }
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
/*if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, " Du kannst dir das Auto nicht selbst verkaufen!");
return 1;
}*/
if(CarCalls[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Der Spieler hat schon ein Auto. Er muss /callcar benutzen !");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Du willst ein Auto an %s für %d Dollar verkaufen.", giveplayer, money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s Will dir ein Auto für %d Dollar verkaufen (Tippe /accept car um es zu kaufen).", sendername, money);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
CarOffer[giveplayerid] = playerid;
CarPrice[giveplayerid] = money;
CarID[giveplayerid] = GetPlayerVehicleID(playerid);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Der Spieler ist nicht in deiner Nähe !");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Der Spieler ist Offline !");
return 1;
}
}
return 1;
}
Alles anzeigen
PHP
if(strcmp("/accept", cmd, true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_job[256];
x_job = strtok(cmdtext, idx);
if(!strlen(x_job))
{
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Akzeptieren __________________|");
SendClientMessage(playerid, COLOR_BENUTZETEXT, "Benutze: /accept [Name]");
SendClientMessage(playerid, COLOR_BENUTZETEXT2, "Mögliche Namen: Sex, Repair, Rechtsvertreter, Live, Refill, Oamt, medickit");
SendClientMessage(playerid, COLOR_BENUTZETEXT2, "Mögliche Namen: Taxi, Bus, Medic, Mechanic, Ticket, Hotdog, Invite, Orginvite");
SendClientMessage(playerid, COLOR_WHITE, "|________________________________________________|");
return 1;
}
if(strcmp(x_job,"car",true) == 0)
{
if(CarOffer[playerid] < 999)
{
if(IsPlayerConnected(CarOffer[playerid]))
{
if(GetPlayerMoney(playerid) > CarPrice[playerid])
{
if(IsPlayerInVehicle(CarOffer[playerid], CarID[playerid]))
{
new preis = Kaufliste[Spectating[playerid]][Preis];
new autohaus = Kaufliste[Spectating[playerid]][Autohaus];
GetPlayerName(CarOffer[playerid], giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Du hast ein Auto für $%d von Auto Dealer %s gekauft.",CarPrice[playerid],giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Du hast %s dein Auto für $%d verkauft.",sendername,CarPrice[playerid]);
SendClientMessage(CarOffer[playerid], COLOR_LIGHTBLUE, string);
PlayerInfo[CarOffer[playerid]][pPayCheck] += CarPrice[playerid];
GivePlayerMoney(playerid, -CarPrice[playerid]);
RemovePlayerFromVehicle(CarOffer[playerid]);
//CarCalls[playerid] = points;
CarOffer[playerid] = 999;
CarPrice[playerid] = 0;
Carlist[playerid][CarKey[playerid]][Typ] = Spectating[playerid];
Carlist[playerid][CarKey[playerid]][pos_x] = Autospawns[autohaus][pos_x];
Carlist[playerid][CarKey[playerid]][pos_y] = Autospawns[autohaus][pos_y];
Carlist[playerid][CarKey[playerid]][pos_z] = Autospawns[autohaus][pos_z];
Carlist[playerid][CarKey[playerid]][z_angle] = Autospawns[autohaus][z_angle];
Carlist[playerid][CarKey[playerid]][SpawnSaveX] = Autospawns[autohaus][pos_x];
Carlist[playerid][CarKey[playerid]][SpawnSaveY] = Autospawns[autohaus][pos_y];
Carlist[playerid][CarKey[playerid]][SpawnSaveZ] = Autospawns[autohaus][pos_z];
Carlist[playerid][CarKey[playerid]][SpawnSaveRot] = Autospawns[autohaus][z_angle];
Carlist[playerid][CarKey[playerid]][Status] = 0;
Carlist[playerid][CarKey[playerid]][Lock] = 0;
Carlist[playerid][CarKey[playerid]][TankVolumen] = 100;
Carlist[playerid][CarKey[playerid]][Carid] = CreateTunedCar(playerid, CarKey[playerid]);
Carlist[playerid][CarKey[playerid]][Meter] = 0;
Gas[Carlist[playerid][CarKey[playerid]][Carid]] = Carlist[playerid][CarKey[playerid]][TankVolumen];
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Der Dealer ist nicht in dem Auto!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Du kannst das Auto nicht kaufen!");
return 1;
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Keiner will ein Auto verkaufen !");
return 1;
}
}
Alles anzeigen
bei accept läuft was falsch
also da steht unknown und wie lässt man das vom spieler undso abfragen damit genau dieses auto verkauft wird wo er gerade den schlüssel in der hand hat