[Ajuda] Save Matricula
#1

Boas pessoal, eu estou a pedir ajuda, porque eu nгo estou a conseguir fazer uma forma de guardar a matrнcula do veнculo.
Eu tenho o comando abaixo:

pawn Код:
if(strcmp(cmd, "/mudarmatricula", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 10)
        {
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            idx++;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_GREY, "{AA3333}/amudarmat{AFAFAF} [matricula]");
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), result);
        }
        return 1;
    }
Ja tentei fazer a funзгo [cMatricula] mas deu erros.......
A matricula do veiculo muda quando faзo o comando e dou respawn, mas quando dou restart ao servidor a matricula volta para a original do 0.3c ( XYZR000 )....

Cumps,
Swat

EDIT: Eu uso a Dini...
Reply
#2

aa e a placa do carro e isso Matricula nao deu pra intender

Aca fplacas By DraKiNs

http://forum.sa-mp.com/showthread.ph...hlight=fplacas
Reply
#3

Jб fiz o que o Drakins meteu, sу que fiz o comando e depois quando dei RR ao server perdi a matricula, e no ficheiro PlacasVeiculos.fek, nao aparecia la nada quando fazia esse comando :/
Reply
#4

Tendo a include KveH: https://sampforum.blast.hk/showthread.php?tid=228434


Troque todos os seus SetVehicleNumberPlate por SetVehiclePlate e coloque:


pawn Код:
//No OnGameModeExit:

for(new x = 0; x < MAX_VEHICLES; x++)
{
    new SlotNoArquivo[20];
        format(SlotNoArquivo,20,"PlacaID%i", x);
    dini_Set("ArquivoPlaca", SlotNoArquivo, GetVehiclePlate[x]);//Troque "ArquivoPlaca" pelo nome do arquivo.      
}



//No OnGameModeInit:
for(new y = 0; y < MAX_VEHICLES; y++)
{
    new SlotNoArquivo[20];
        format(SlotNoArquivo,20,"PlacaID%i", y);
        SetVehiclePlate(y, dini_Get("ArquivoPlaca", SlotNoArquivo));//Troque "ArquivoPlaca" pelo nome do arquivo.  
}

Espero ter ajudado
Reply
#5

Eu tenha essa include, mas faзo SetVehiclePlate, e da-me erro, do undefined symbol.

Ja fiz o new SetVehiclePlate; mas ainda da mais erros :/
Reply
#6

vc coloco no comeзo do gm junto as outras includes :
#include <KveH>
?
Reply
#7

Realmente й verdade, a funзгo sizeof do sa-mp nгo suporta arrays multidimensionais =/, e isso nгo й dito em nenhum manual , por isso deu bug no SetVehiclePlate.


Atualizei a include, teste-a agora com o cуdigo que disse pra vocк, Swat007forever:


https://sampforum.blast.hk/showthread.php?tid=228434


Espero ter ajudado
Reply
#8

Deu erros, rjjj.

Mas jб nгo foi da Include, foi da cena no OnGameModeExit, os erros que me deram foram os seguintes:

C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : error 028: invalid subscript (not an array or too many subscripts): "GetVehiclePlate"
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : warning 215: expression has no effect
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : error 001: expected token: ";", but found "]"
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : error 029: invalid expression, assumed zero
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : fatal error 107: too many error messages on one line

E foi nesta linha:

pawn Код:
dini_Set("ArquivoPlaca", SlotNoArquivo, GetVehiclePlate[x]);//Troque "ArquivoPlaca" pelo nome do arquivo.
Reply
#9

Quote:
Originally Posted by Swat007forever
Посмотреть сообщение
Deu erros, rjjj.

Mas jб nгo foi da Include, foi da cena no OnGameModeExit, os erros que me deram foram os seguintes:

C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : error 028: invalid subscript (not an array or too many subscripts): "GetVehiclePlate"
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : warning 215: expression has no effect
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : error 001: expected token: ";", but found "]"
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : error 029: invalid expression, assumed zero
C:\Users\Swat\Desktop\GMV-RP\gamemodes\gmvrp.pwn(29083) : fatal error 107: too many error messages on one line

E foi nesta linha:

pawn Код:
dini_Set("ArquivoPlaca", SlotNoArquivo, GetVehiclePlate[x]);//Troque "ArquivoPlaca" pelo nome do arquivo.
Ops, eram parкnteses e nгo colchetes no seu cуdigo, malz, falha nossa

O certo й assim:

pawn Код:
dini_Set("ArquivoPlaca.txt", SlotNoArquivo, GetVehiclePlate(x));//Troque "ArquivoPlaca" pelo nome do arquivo.
Espero ter ajudado
Reply
#10

Obrigadгo rjj

Cumps,
Torres
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)