16.01.2013, 16:20
Hello there i trying to script that script for hours so plz help me.... The problem is, i made SCarInfo(sales) system, but car just dont want to save his postion and model.... its always gone.... Im out of ideas plz help me. Let me show ya my script:
Код HTML:
public LoadSCar() { new file[26]; for(new idx = 1; idx < sizeof(SCarInfo) ; idx++) { format(file, sizeof(file),"LARP/Vehicles/SALES/%d.ini", idx); SCarInfo[idx][cSModel] = dini_Int(file,"SModel"); SCarInfo[idx][cSLocationx] = dini_Float(file,"SLocation_X"); SCarInfo[idx][cSLocationy] = dini_Float(file,"SLocation_Y"); SCarInfo[idx][cSLocationz] = dini_Float(file,"SLocation_Z"); SCarInfo[idx][cSAngle] = dini_Float(file,"SAngle"); SCarInfo[idx][cSColorOne] = dini_Int(file,"SColor_1"); SCarInfo[idx][cSColorTwo] = dini_Int(file,"SColor_2"); } return 1; }
Код HTML:
public ScarUpdate(idx) { new file1[64]; format(file1, sizeof(file1),"LARP/Vehicles/SALES/%d.ini",idx); dini_IntSet(file1,"Model",SCarInfo[idx][cSModel]); dini_FloatSet(file1,"SLocation_X",SCarInfo[idx][cSLocationx]); dini_FloatSet(file1,"SLocation_Y",SCarInfo[idx][cSLocationy]); dini_FloatSet(file1,"SLocation_Z",SCarInfo[idx][cSLocationz]); dini_FloatSet(file1,"SAngle",SCarInfo[idx][cSAngle]); dini_IntSet(file1,"SColor_1",SCarInfo[idx][cSColorOne]); dini_IntSet(file1,"SColor_2",SCarInfo[idx][cSColorTwo]); }
Код HTML:
if(strcmp(cmd, "/salesveh", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] < 1338) { SendClientMessage(playerid, COLOR_GRAD1, " Silly Admin/Boy This Command Is only For the GameMaster"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /salesveh [carid] [color1] [color2]"); return 1; } new car; car = strval(tmp); if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611 !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /salesveh [carid] [color1] [color2]"); return 1; } new color1; color1 = strval(tmp); if(color1 < -1 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /salesveh [carid] [color1] [color2]"); return 1; } new color2; color2 = strval(tmp); if(color2 < -1 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; } new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z); new Float:Angle; GetPlayerFacingAngle(playerid, Angle); new carid = CreateVehicle(car, X,Y,Z, Angle, color1, color2, 60000); salescar[carid] = carid; SCarInfo[idx][cSLocationx] = X; SCarInfo[idx][cSLocationy] = Y; SCarInfo[idx][cSLocationz] = Z; SCarInfo[idx][cSAngle] = Angle; LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); PutPlayerInVehicle(playerid, carid, 0); format(string, sizeof(string), "** Vehicle %d spawned.", carid); SendClientMessage(playerid, COLOR_GREY, string); new housename[24]; GetVehicleName(carid, housename, sizeof(housename)); new area[36]; GetPlayer2DZone(playerid, area, sizeof(area)); format(string,sizeof(string), "[ADMIN]: %s Has Spawned a Sales %s (%d) [%d] At His Position (%s).",sendername,housename,car,carid,area); ABroadCast(COLOR_LIGHTRED, string, 5); new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Spawned a Sales %s (%d) [%d] (Color 1: %d | Color 2: %d) At His Position.",d,m,y,h,mi,s,sendername,housename,car,carid,color1,color2); AdminLog(string); ScarUpdate(idx); } return 1; } if(strcmp(cmd, "/salespark", true) == 0) { if (PlayerInfo[playerid][pAdmin] < 1400) { SendClientMessage(playerid, COLOR_GRAD1, " Silly Admin/Boy This Command Is only For the GameMaster"); return 1; } if(IsPlayerInAnyVehicle(playerid)) { new carid; new vehicleid; carid = GetPlayerVehicleID(playerid); new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z); new Float:Angle; GetPlayerFacingAngle(playerid, Angle); SCarInfo[carid][cSLocationx] = X; SCarInfo[carid][cSLocationy] = Y; SCarInfo[carid][cSLocationz] = Z; SCarInfo[carid][cSAngle] = Angle; ScarUpdate(idx); SetVehicleToRespawn(GetPlayerVehicleID(playerid)); LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0); SafeRemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_GRAD1, " Sales Vehicle Parked "); } else { SendClientMessage(playerid, COLOR_GRAD1, " Go in sales vehicle"); } }
Код HTML:
enum cSInfo { cSModel, Float:cSLocationx, Float:cSLocationy, Float:cSLocationz, Float:cSAngle, cSColorOne, cSColorTwo, }; new SCarInfo[600][cSInfo];