Hey guys, i did command /asellcar, but problem is there because when admin sells car by this, player's veh key stays still, and if someone know how, let me know. I want to do when admin sells car by this command, that player's carkey sets to default(999).
Код:
if(!strcmp(cmdtext, "/asellcar", true))
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Morate se prvo prijaviti !");
return 1;
}
if(PlayerInfo[playerid][pAdmin] >= 1339)
{
new vehid = GetPlayerVehicleID(playerid);
new Float:x,Float:y,Float:z;
new Float:a;
CarInfo[vehid][cOwned] = 0;
strmid(CarInfo[vehid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "{00C0FF}ADMIN:{ffffff} %s{00C0FF} je prodao auto ID:{ffffff} %d",sendername,vehid);
SendAdminMessage(COLOR_YELLOW,string);
GetVehiclePos(vehid, x, y, z);
GetVehicleZAngle(vehid, a);
CarInfo[vehid][cLocationx] = x;
CarInfo[vehid][cLocationy] = y;
CarInfo[vehid][cLocationz] = z;
CarInfo[vehid][cAngle] = a;
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
if(CarInfo[vehid][cOwned]==0)
{
GetVehiclePos(vehid, x,y,z);
format(PropertyString,sizeof(PropertyString),"{FFFF80}Auto na prodaju\n Model: %s \n Cena: $%d \n /v buy da kupis!",CarInfo[vehid][cDescription],CarInfo[vehid][cValue]);
VehicleLabel[vehid] = Create3DTextLabel(PropertyString, 0xFF0000CC, x, y, z, 20, 0, 1);
Attach3DTextLabelToVehicle(VehicleLabel[vehid],vehid,0,0,0);
Delete3DTextLabel(VehicleLabels[vehid]);
}
DestroyVehicle(vehid);
OnPropUpdate();
CreateVehicle(CarInfo[vehid][cModel],CarInfo[vehid][cLocationx],CarInfo[vehid][cLocationy],CarInfo[vehid][cLocationz]+1.0,CarInfo[vehid][cAngle],CarInfo[vehid][cColorOne],CarInfo[vehid][cColorTwo],60000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, ""SNEMOGUCNOST"");
return 1;
}
}
return 1;
}