21.08.2012, 09:10
I have the command /sellveh what sell your personal car to dealership. But there is a problem: With this command you can sell the vehicle of another player. How to make it work just for your personal vehicle?
I hope this can help you:
Код:
if (strcmp("/sellveh", cmdtext, true, 10) == 0) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, ORANGE, "You must be in a car for this action"); if(GetCreatorID(vehicleid)!=0) { format(file,64,"personalcars/%s.ini",VehicleSystem[vehicleid][owner]); dini_Remove(file); new Float:vx,Float:vy,Float:vz,Float:va; GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz); GetVehicleZAngle(GetPlayerVehicleID(playerid),va); VehicleSystem[GetCreatorID(vehicleid)][xc]=vx; VehicleSystem[GetCreatorID(vehicleid)][yc]=vy; VehicleSystem[GetCreatorID(vehicleid)][zc]=vz; VehicleSystem[GetCreatorID(vehicleid)][ac]=va; Locked[GetCreatorID(vehicleid)] = 0; VehicleSystem[GetCreatorID(vehicleid)][Lock] = 0; strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128); new create = GetCreatorID(vehicleid); DestroyVehicle(vehicleid); new CAR = CreateVehicle(VehicleSystem[create][cmodel],VehicleSystem[create][xc],VehicleSystem[create][yc],VehicleSystem[create][zc],VehicleSystem[create][ac],VehicleSystem[create][Farbe1],VehicleSystem[create][Farbe2],-1); SetVehicleNumberPlate(CAR, VehicleSystem[GetCreatorID(vehicleid)][owner]); VehicleSystem[GetCreatorID(vehicleid)][mod1]=0; VehicleSystem[GetCreatorID(vehicleid)][mod2]=0; VehicleSystem[GetCreatorID(vehicleid)][mod3]=0; VehicleSystem[GetCreatorID(vehicleid)][mod4]=0; VehicleSystem[GetCreatorID(vehicleid)][mod5]=0; VehicleSystem[GetCreatorID(vehicleid)][mod6]=0; VehicleSystem[GetCreatorID(vehicleid)][mod7]=0; VehicleSystem[GetCreatorID(vehicleid)][mod8]=0; VehicleSystem[GetCreatorID(vehicleid)][mod9]=0; VehicleSystem[GetCreatorID(vehicleid)][mod10]=0; VehicleSystem[GetCreatorID(vehicleid)][mod11]=0; VehicleSystem[GetCreatorID(vehicleid)][mod12]=0; VehicleSystem[GetCreatorID(vehicleid)][mod13]=0; VehicleSystem[GetCreatorID(vehicleid)][mod14]=0; VehicleSystem[GetCreatorID(vehicleid)][mod15]=0; VehicleSystem[GetCreatorID(vehicleid)][mod16]=0; VehicleSystem[GetCreatorID(vehicleid)][mod17]=0; VehicleSystem[GetCreatorID(vehicleid)][paintjob]=255; VehicleSystem[GetCreatorID(vehicleid)][Farbe1]=1; VehicleSystem[GetCreatorID(vehicleid)][Farbe2]=1; ChangeVehicleColor(vehicleid, 1,1); SendClientMessage(playerid, COLOR_WHITE, "This car is now for sale! "); } return 1; }
Код:
if(dini_Int(PFile(playerid),"HaveCar") == 0) return SendClientMessage(playerid, ORANGE, "[ERROR]You dont have a car");