SA-MP Forums Archive
Licenses Plate - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Licenses Plate (/showthread.php?tid=274982)



Licenses Plate - rashier - 07.08.2011

Hello, I have this
Quote:

if (strcmp(cmd, "/changeplate", true, 12)==0)
{
cmd = strtok(cmdtext, idx);
if(!strlen(cmd))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /changeplate [platenumber (up to 8 chars, use '-' for space char)]");
return 1;
}
if(IsPlayerInAnyVehicle(playerid) == 1)
{
SetVehicleNumberPlate(GetPlayerVehicleID(playerid) , cmd);
new vehid=GetPlayerVehicleID(playerid);
SetVehicleToRespawn(vehid);
SendClientMessage(playerid, 0xFF9900AA, "License plate changed!");
new Float;
new Float:y;
new Float:z;
new Float;
GetVehicleZAngle(vehid, p);
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(vehid, x, y, z);
SetVehicleZAngle(vehid, p);
//GameTextForPlayer(playerid, cmd, 2500, 3);
PutPlayerInVehicle(playerid, vehid, 0);

return 1;
}
else
{
SendClientMessage(playerid, 0xFF9900AA, "You are not in a vehicle.");
}
return 1;
}

command on the gamemode, and I would like to somehow save the license plates.
I can help someone make a save file? Please helpme ....
If you need something gamemode, ask me.


Re: Licenses Plate - RockFire - 09.08.2011

pawn Код:
if(!strcmp(cmd, "/changeplate", true, 12))
{
    new tmp[128];
    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.");

    new vehid = GetPlayerVehicleID(playerid);
    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;
}



Re: Licenses Plate - rashier - 09.08.2011

not work,my licenses plate on cars,not saved...comeone man,please helpme....


Re: Licenses Plate - TheArcher - 09.08.2011

Well you have to use a INI system for improve the read/write speed. you can use DINI for exemple.

Here is DINI system.

It will be like:

pawn Код:
if(!strcmp(cmd, "/changeplate", true, 12))
{
    new tmp[128], file, name[MAX_PLAYER_NAME];
    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.");

    format(file, sizeof(file), "%s's plate.ini", name);
    if(!dini_Exists(file)) {
        dini_Create(file);
        dini_IntSet(file, "CarPlate", tmp);
    }
    new vehid = GetPlayerVehicleID(playerid);
    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;
}
NOTE: This is a exemple of saving. It will save only the number of license plate


Re: Licenses Plate - rashier - 10.08.2011

gives me this:
Quote:

warning 219: local variable "tmp" shadows a variable at a preceding level
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
warning 203: symbol is never used: "file"




Re: Licenses Plate - TheArcher - 10.08.2011

Quote:
Originally Posted by rashier
Посмотреть сообщение
gives me this:
new file[128]; i forgot


Re: Licenses Plate - rashier - 10.08.2011

ok,i set this:
Quote:

if(!strcmp(cmd, "/changeplate", true, 12))
{
new tmp[128], name[MAX_PLAYER_NAME], file[128];
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.");

format(file, sizeof(file), "%s's plate.ini", name);
if(!dini_Exists(file)) {
dini_Create(file);
dini_IntSet(file, "CarPlate", tmp);
}
new vehid = GetPlayerVehicleID(playerid);
SetVehicleNumberPlate(GetPlayerVehicleID(playerid) ,tmp);
SetVehicleToRespawn(vehid);
SendClientMessage(playerid, 0xFF9900AA, "License plate changed!");
new Float, 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;
}

and set new file [128], where the start order, but did not work, gave me other errors, so I added the command, which was already, new tabs, and added new file [128 ];.... . but it still gives me an error:
Quote:

(35007) : warning 219: local variable "tmp" shadows a variable at a preceding level
(35019) : error 035: argument type mismatch (argument 3)




Re: Licenses Plate - rashier - 11.08.2011

even one across the site knows to help me?


Re : Licenses Plate - jasonnw666 - 11.08.2011

just rename tmp by other name


Re: Licenses Plate - Darnell - 11.08.2011

Is this solved ? I'd like to use this command aswell.