Dealership help
#1

Hello. Maybe someone can help me with this...havent script atleast 3 years and dont remember exactly what to i have to do here. Problem is when i try to buy a car im still not owner

Код:
//Dealership
forward SaveCars(id);
public SaveCars(id)
{
    new file4[40];
    format(file4, sizeof(file4), APATH, id);
    new INI:File = INI_Open(file4);
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Hind", AutoInfo[id][aHind]);
    INI_WriteString(File,"Omanik", AutoInfo[id][aOmanik]);
    INI_WriteInt(File,"Tььp", AutoInfo[id][aTyyp]);
    INI_WriteFloat(File,"AsukohtX", AutoInfo[id][aX]);
    INI_WriteFloat(File,"AsukohtY", AutoInfo[id][aY]);
    INI_WriteFloat(File,"AsukohtZ", AutoInfo[id][aZ]);
    INI_WriteFloat(File,"SuundR", AutoInfo[id][aR]);
    INI_WriteInt(File,"Vдrv_1", AutoInfo[id][aColor1]);
    INI_WriteInt(File,"Vдrv_2", AutoInfo[id][aColor2]);
    INI_WriteInt(File,"Alarm", AutoInfo[id][aAlarm]);
    INI_WriteInt(File,"Ostetud", AutoInfo[id][aOstetud]);
    INI_WriteInt(File,"Tehtud", AutoInfo[id][aTehtud]);
    INI_Close(File);
    return 1;
}

forward loadcars_data(idx, name[], value[]);
public loadcars_data(idx, name[], value[])
{
    INI_Int("Hind", AutoInfo[idx][aHind]);
    INI_String("Omanik", AutoInfo[idx][aOmanik], 99);
    INI_Int("Tььp", AutoInfo[idx][aTyyp]);
    INI_Float("AsukohtX", AutoInfo[idx][aX]);
    INI_Float("AsukohtY", AutoInfo[idx][aY]);
    INI_Float("AsukohtZ", AutoInfo[idx][aZ]);
    INI_Float("SuundR", AutoInfo[idx][aR]);
    INI_Int("Vдrv_1", AutoInfo[idx][aColor1]);
    INI_Int("Vдrv_2", AutoInfo[idx][aColor2]);
    INI_Int("Alarm", AutoInfo[idx][aAlarm]);
    INI_Int("Ostetud", AutoInfo[idx][aOstetud]);
    INI_Int("Tehtud", AutoInfo[idx][aTehtud]);
    return 1;
}
Код:
//Load System
    for(new aid = 1; aid < sizeof(AutoInfo); aid++)
    {
        format(str, sizeof(str), APATH, aid);
        INI_ParseFile(str, "loadcars_%s", .bExtra = true, .extra = aid );
		if(AutoInfo[aid][aOstetud] == 0)
		{
            format(string, sizeof(string), "[ Sхiduk ]\n\nSхiduk on mььgis.\nHind: %d", AutoInfo[aid][aHind]);
			AutoInfo[aid][aTextID] = CreateDynamic3DTextLabel(string, TUMESININE, AutoInfo[aid][aX], AutoInfo[aid][aY], AutoInfo[aid][aZ], 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0, 0, 20.0);
            AutoInfo[aid][aTehtud] = CreateVehicle (AutoInfo[aid][aTyyp], AutoInfo[aid][aX], AutoInfo[aid][aY], AutoInfo[aid][aZ], AutoInfo[aid][aR], AutoInfo[aid][aColor2], AutoInfo[aid][aColor2], SRA);
		}
		if(AutoInfo[aid][aOstetud] == 1)
		{
  		    AutoInfo[aid][aTehtud] = CreateVehicle (AutoInfo[aid][aTyyp], AutoInfo[aid][aX], AutoInfo[aid][aY], AutoInfo[aid][aZ], AutoInfo[aid][aR], AutoInfo[aid][aColor2], AutoInfo[aid][aColor2], SRA);
		}
    }
Код:
//Dealership
	for(new b = 1; b < sizeof(AutoInfo); b++)
 	{
    	if(AutoInfo[b][aOmanik] == KasutajaInfo[playerid][Name])
		{
		    SendClientMessage(playerid, -1, "See sхiduk kuulub sulle!"); //Owner
		}
		else
		{
   			SendClientMessage(playerid, -1, "See sхiduk ei kuulu sulle!");//Not owner
		}
	}
Код:
 CMD:addcar(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid, HALL, "Sul ei ole vastavaid volitusi!");
    new price, id, string[128], tyyp;
    if(sscanf(params, "dd", price, tyyp)) return SCM(playerid, HALL, "CMD: /addcar [hind] [Sхiduki ID] ");

    if(tyyp < 400 || tyyp > 611) return SCM(playerid, VALGE, "Sellist sхidukit ei eksisteeri! (400-611)");

    if(price < 500) return SCM(playerid, HALL, "CMD: Summa ei tohi olla vдiksem kui $500.");

    for(new h = 1;h < sizeof(AutoInfo);h++)
    {
        if(AutoInfo[h][aHind] == 0)
        {
            id = h;
            break;
        }
    }
    new Float:X,Float:Y,Float:Z,Float:A;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
	AutoInfo[id][aOmanik] = 0;
    AutoInfo[id][aHind] = price;
    AutoInfo[id][aX] = X;
    AutoInfo[id][aY] = Y;
    AutoInfo[id][aZ] = Z;
    AutoInfo[id][aR] = A;
    AutoInfo[id][aColor1] = -1;
    AutoInfo[id][aColor2] = -1;
    AutoInfo[id][aAlarm] = 0;
    AutoInfo[id][aOstetud] = 0;
    AutoInfo[id][aTyyp] = tyyp;
    AutoInfo[id][aTehtud] = 1;

    CreateVehicle(tyyp, X, Y, Z, A, AutoInfo[id][aColor1], AutoInfo[id][aColor2], SRA);
    format(string, sizeof(string), "[ Sхiduk ]\n\nSхiduk on mььgis.\nHind: %d", AutoInfo[id][aHind]);
	AutoInfo[id][aTextID] = CreateDynamic3DTextLabel(string, TUMESININE, AutoInfo[id][aX], AutoInfo[id][aY], AutoInfo[id][aZ], 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0, 0, 20.0);

	new file4[40];
    format(file4, sizeof(file4), APATH, id);
    new INI:File = INI_Open(file4);
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Hind", AutoInfo[id][aHind]);
    INI_WriteString(File,"Omanik", AutoInfo[id][aOmanik]);
    INI_WriteInt(File,"Tььp", AutoInfo[id][aTyyp]);
    INI_WriteFloat(File,"AsukohtX", AutoInfo[id][aX]);
    INI_WriteFloat(File,"AsukohtY", AutoInfo[id][aY]);
    INI_WriteFloat(File,"AsukohtZ", AutoInfo[id][aZ]);
    INI_WriteFloat(File,"SuundR", AutoInfo[id][aR]);
    INI_WriteInt(File,"Vдrv_1", AutoInfo[id][aColor1]);
    INI_WriteInt(File,"Vдrv_2", AutoInfo[id][aColor2]);
    INI_WriteInt(File,"Alarm", AutoInfo[id][aAlarm]);
    INI_WriteInt(File,"Ostetud", AutoInfo[id][aOstetud]);
    INI_WriteInt(File,"Tehtud", AutoInfo[id][aTehtud]);
    INI_Close(File);
    return 1;
}
Код:
//Buy Car
CMD:ostaauto(playerid, params[])
{
	new plname[MAX_PLAYER_NAME], id;
	
    GetPlayerName(playerid, plname, sizeof(plname));
	for(new h = 1;h < sizeof(AutoInfo);h++)
    {
        if(AutoInfo[h][aHind] == 0)
        {
            id = h;
            break;
        }
    }
    new OMID;
    OMID = GetPlayerVehicleID(playerid);
    
    if(AutoInfo[id][aOstetud] != 0 || AutoInfo[id][aHind] == 0) return SCM(playerid, HALL, "See sхiduk pole mььgis.");
    
    if(KasutajaInfo[playerid][S6iduk1] == 0)
	{
	    KasutajaInfo[playerid][S6iduk1] = OMID;
	}
	else if (KasutajaInfo[playerid][S6iduk2] == 0)
	{
	    KasutajaInfo[playerid][S6iduk2] = OMID;
	}
	else if (KasutajaInfo[playerid][S6iduk3] == 0)
	{
		KasutajaInfo[playerid][S6iduk3] = OMID;
	}
	else if (KasutajaInfo[playerid][S6iduk4] == 0)
	{
		KasutajaInfo[playerid][S6iduk4] = OMID;
	}
	else if (KasutajaInfo[playerid][S6iduk5] == 0)
	{
		KasutajaInfo[playerid][S6iduk5] = OMID;
	}
	else
	{
	    SCM(playerid, PUNANE, "Sa ei saa rohkem sхidukeid osta!");
	}

    if(KasutajaInfo[playerid][Money] < AutoInfo[id][aHind]) return SCM(playerid, HELEPUNANE, "Vabandame, sul ei ole piisavalt raha.");

   // KasutajaInfo[playerid][S6iduk1] || KasutajaInfo[playerid][S6iduk2] || KasutajaInfo[playerid][S6iduk3] || KasutajaInfo[playerid][S6iduk4] || KasutajaInfo[playerid][S6iduk5] = id;
    AnnaIGRaha(playerid, -AutoInfo[id][aHind]);
    AutoInfo[id][aOstetud] = 1;
    format(AutoInfo[id][aOmanik], 128, "%s", plname);

	DestroyDynamic3DTextLabel(AutoInfo[id][aTextID]);
	SCM(playerid, KOLLANE, "Хnnitlused uue sхiduki puhul! Kasuta /sхiduk et vaadata sхiduki kдsklusi!");
    return 1;
}
Reply
#2

Since the language is weird to understand, Why don't you go to the foreign language section?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)