SA-MP Forums Archive
Plate System [ REQ ] - 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: Plate System [ REQ ] (/showthread.php?tid=297289)



Plate System [ REQ ] - XDTheProGamerz - 15.11.2011

Can anyone Give me how to put Plate System for RP Server and it will save when we logout/offline


Re: Plate System [ REQ ] - FarSe. - 15.11.2011

I think you want something like this
Quote:
Originally Posted by Me
Посмотреть сообщение
So you want to save vehicle licenses plate and load it after restart?
pawn Код:
if(!strcmp(cmd, "/changeplate", true, 12))
    {
        new Tmp[124];
        Tmp = strtok(cmdtext, idx);
        if(!strlen(Tmp))
            return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /changeplate [platenumber (up to 8 chars, use '-' for space char)]");

        if(!IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid, 0xFF9900AA, "You are not in a vehicle.");

        if(!dini_Exists("CarPlates.ini")) {
            dini_Create("CarPlates.ini");
        }
        new Str[128];
        new vehid = GetPlayerVehicleID(playerid);
        format(Str,128,"%d",vehid);
        dini_Set("CarPlates.ini", Str, Tmp);
        SetVehicleNumberPlate(GetPlayerVehicleID(playerid),Tmp);
        SetVehicleToRespawn(vehid);
        SendClientMessage(playerid, 0xFF9900AA, "License plate changed!");
        new Float:x, Float:y, Float:z, Float:a;
        GetVehicleZAngle(vehid,a);
        GetPlayerPos(playerid,x,y,z);
        SetVehiclePos(vehid,x,y,z);
        SetVehicleZAngle(vehid,a);
        PutPlayerInVehicle(playerid, vehid, 0);
        return 1;
    }
OnGameMode/FilterScript Init:
pawn Код:
LoadPlates();
Anywhere:
pawn Код:
LoadPlates()
{
    new File:H = fopen("CarPlates.ini",io_read);
    new str[128],car,plate[10];
    while(fread(H, str))
    {
        strmid(plate,str,0,strfind(str,"=",true));
        car = strval(plate);
        strmid(plate,str,strfind(str,"=",true),strlen(str)-1);
        SetVehicleNumberPlate(car,plate);
    }
}



Re: Plate System [ REQ ] - aRoach - 15.11.2011

Anywhere... but not in another Callback... :
pawn Код:
LoadPlates()
{
    new File:H = fopen("CarPlates.ini",io_read);
    new str[128],car,plate[10];
    while(fread(H, str))
    {
        strmid(plate,str,0,strfind(str,"=",true));
        car = strval(plate);
        strmid(plate,str,strfind(str,"=",true),strlen(str)-1);
        SetVehicleNumberPlate(car,plate);
    }
}



Re: Plate System [ REQ ] - Kostas' - 15.11.2011

Quote:
Originally Posted by aRoach
Посмотреть сообщение
Anywhere... but not in another Callback... :
pawn Код:
LoadPlates()
{
    new File:H = fopen("CarPlates.ini",io_read);
    new str[128],car,plate[10];
    while(fread(H, str))
    {
        strmid(plate,str,0,strfind(str,"=",true));
        car = strval(plate);
        strmid(plate,str,strfind(str,"=",true),strlen(str)-1);
        SetVehicleNumberPlate(car,plate);
    }
}
Not only this. You need to create the file and save it to it.


Re: Plate System [ REQ ] - vassilis - 15.11.2011

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
Not only this. You need to create the file and save it to it.
Edit:my bad didnt watch it also dont forget to use the includes..because lot new scripters are doing it


Re : Plate System [ REQ ] - Jack_Loreva - 08.08.2012

Can you write The full script With ZCMD Please ?