SA-MP Forums Archive
[Help] Plate system saving - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Plate system saving (/showthread.php?tid=288280)



[Help] Plate system saving - Ofnet - 07.10.2011

Hello,

I am looking for some one to help me with that plate system. I need when I use "/plate" my vehicle plate save in scriptfiles/notepad file.

with dini.

Here is the whole script of my /plate system.

pawn Код:
if(strcmp(cmd, "/plate",true)== 0)
    {
    new ID = GetPlayerVehicleID(playerid);

    new strings[256];
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
    else
    {
        format(strings, sizeof(strings), "%s",tmp);
        SetVehicleNumberPlate(ID,strings);
        strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
        SetVehicleToRespawn(ID);
        format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
        SendClientMessage(playerid, COLOR_LIGHTRED, strings);
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        SaveCars();

    }
    return 1;
    }

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    VehicleEngine[vehicleid] = 0;
    VehicleWindows[vehicleid] = 0;
    CarRadio[vehicleid] = 0;
    SetVehicleNumberPlate(vehicleid,CarInfo[VehicleOwned[vehicleid]][cLicense]);
    if(VehicleOwned[vehicleid] != SCRIPT_CARS)
    {
        if(VehSpawned[vehicleid] == 0)
        {
            VehicleOwned[vehicleid] = SCRIPT_CARS;
            DestroyVehicle(vehicleid);
            VehSpawned[vehicleid] = 0;
        }
        else
        {
            VehSpawned[vehicleid] = 0;
        }
    }
    return 1;
}



Re: [Help] Plate system saving - [MWR]Blood - 07.10.2011

Use Y_INI.


Re: [Help] Plate system saving - Ofnet - 07.10.2011

Can you help me with Y_INI in that Script??


Re: [Help] Plate system saving - [MWR]Blood - 07.10.2011

Search for tutorials with it, there are a lot!


Re: [Help] Plate system saving - Ofnet - 07.10.2011

Sir, I search the tutorial. But I'll not find any point how to add stuff in my script..

Thanks for the help!!


Re: [Help] Plate system saving - Mr. Random - 07.10.2011

pawn Код:
if(strcmp(cmd, "/plate",true)== 0)
{
    new ID = GetPlayerVehicleID(playerid);

    new strings[256];
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
    else
    {
        format(strings, sizeof(strings), "%s",tmp);
        SetVehicleNumberPlate(ID,strings);
        strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
        SetVehicleToRespawn(ID);
        format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
        SendClientMessage(playerid, COLOR_LIGHTRED, strings);
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        new string[128];
        format(string, sizeof(string), "plates.ini");
        if(!dini_Exists(string))
        {
            dini_Create(string);
            dini_Set(string, "License Plate", tmp);
        }
        SaveCars();

    }
    return 1;
}
Untested.


Re: [Help] Plate system saving - Ofnet - 07.10.2011

i need to make any folder in scriptfiles??


Re: [Help] Plate system saving - Mr. Random - 07.10.2011

No, why ? it saves in plates.ini.