[Ajuda] Salvamento
#1

Ola Mlata,й o seguinte,no meu GM,tenho la o tunning,tudo certinho,o carro da respawn o tunning salva,sу que quando dou /gmx (restart) no servidor o tunning desaparece,eu queria se me acoselhasem-me um salvamento de tunning,mas so kero que salve,porque tunar,ja eu tenho :S se me alguem conseguir ajudar ficava grato
Reply
#2

https://sampwiki.blast.hk/wiki/Saving_car_mods
lol, wiki tem quase tudo cara, й sу procurar
Reply
#3

a uma parte que й esta
pawn Код:
public SaveComponent(vehicleid,componentid)
{
    new playerid = GetDriverID(vehicleid);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
            if (strcmp(VehicleInfo[vehicleid][owner],PlayerInfo[playerid][name],false) == 0) {
                for(new s=0; s<20; s++) {
                    if(componentid == spoiler[s][0]) {
                        VehicleInfo[vehicleid][mod1] = componentid;
                    }
                }
                for(new s=0; s<3; s++) {
                    if(componentid == nitro[s][0]) {
                        VehicleInfo[vehicleid][mod2] = componentid;
                    }
                }
                for(new s=0; s<23; s++) {
                    if(componentid == fbumper[s][0]) {
                        VehicleInfo[vehicleid][mod3] = componentid;
                    }
                }
                for(new s=0; s<22; s++) {
                    if(componentid == rbumper[s][0]) {
                        VehicleInfo[vehicleid][mod4] = componentid;
                    }
                }
                for(new s=0; s<28; s++) {
                    if(componentid == exhaust[s][0]) {
                        VehicleInfo[vehicleid][mod5] = componentid;
                    }
                }
                for(new s=0; s<2; s++) {
                    if(componentid == bventr[s][0]) {
                        VehicleInfo[vehicleid][mod6] = componentid;
                    }
                }
                for(new s=0; s<2; s++) {
                    if(componentid == bventl[s][0]) {
                        VehicleInfo[vehicleid][mod7] = componentid;
                    }
                }
                for(new s=0; s<4; s++) {
                    if(componentid == bscoop[s][0]) {
                        VehicleInfo[vehicleid][mod8] = componentid;
                    }
                }
                for(new s=0; s<17; s++) {
                    if(componentid == rscoop[s][0]) {
                        VehicleInfo[vehicleid][mod9] = componentid;
                    }
                }
                for(new s=0; s<21; s++) {
                    if(componentid == lskirt[s][0]) {
                        VehicleInfo[vehicleid][mod10] = componentid;
                    }
                }
                for(new s=0; s<21; s++) {
                    if(componentid == rskirt[s][0]) {
                        VehicleInfo[vehicleid][mod11] = componentid;
                    }
                }
                for(new s=0; s<1; s++) {
                    if(componentid == hydraulics[s][0]) {
                        VehicleInfo[vehicleid][mod12] = componentid;
                    }
                }
                for(new s=0; s<1; s++) {
                    if(componentid == base[s][0]) {
                        VehicleInfo[vehicleid][mod13] = componentid;
                    }
                }
                for(new s=0; s<4; s++) {
                    if(componentid == rbbars[s][0]) {
                        VehicleInfo[vehicleid][mod14] = componentid;
                    }
                }
                for(new s=0; s<2; s++) {
                    if(componentid == fbbars[s][0]) {
                        VehicleInfo[vehicleid][mod15] = componentid;
                    }
                }
                for(new s=0; s<17; s++) {
                    if(componentid == wheels[s][0]) {
                        VehicleInfo[vehicleid][mod16] = componentid;
                    }
                }
                for(new s=0; s<2; s++) {
                    if(componentid == lights[s][0]) {
                        VehicleInfo[vehicleid][mod17] = componentid;
                    }
                }
                return 1;
            }
    }
    return 0;
}
mas tame dando erro por causa do "[name]" alguem sabe porque? S: erro:
pawn Код:
error 017: undefined symbol "name"
Reply
#4

Substitua a callback por esta:

pawn Код:
public SaveComponent(vehicleid, componentid)
{
    new playerid = GetDriverID(vehicleid);
    new L_N[MAX_PLAYER_NAME]; GetPlayerName(playerid, L_N, MAX_PLAYER_NAME);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if (strcmp(VehicleInfo[vehicleid][owner], L_N, false) == 0)
        {
            for(new s=0; s<20; s++) if(componentid == spoiler[s][0]) VehicleInfo[vehicleid][mod1] = componentid;
            for(new s=0; s<3; s++) if(componentid == nitro[s][0]) VehicleInfo[vehicleid][mod2] = componentid;
            for(new s=0; s<23; s++) if(componentid == fbumper[s][0]) VehicleInfo[vehicleid][mod3] = componentid;
            for(new s=0; s<22; s++) if(componentid == rbumper[s][0]) VehicleInfo[vehicleid][mod4] = componentid;
            for(new s=0; s<28; s++) if(componentid == exhaust[s][0]) VehicleInfo[vehicleid][mod5] = componentid;
            for(new s=0; s<2; s++) if(componentid == bventr[s][0]) VehicleInfo[vehicleid][mod6] = componentid;
            for(new s=0; s<2; s++) if(componentid == bventl[s][0]) VehicleInfo[vehicleid][mod7] = componentid;
            for(new s=0; s<4; s++) if(componentid == bscoop[s][0]) VehicleInfo[vehicleid][mod8] = componentid;
            for(new s=0; s<17; s++) if(componentid == rscoop[s][0]) VehicleInfo[vehicleid][mod9] = componentid;
            for(new s=0; s<21; s++) if(componentid == lskirt[s][0]) VehicleInfo[vehicleid][mod10] = componentid;
            for(new s=0; s<21; s++) if(componentid == rskirt[s][0]) VehicleInfo[vehicleid][mod11] = componentid;
            for(new s=0; s<1; s++) if(componentid == hydraulics[s][0]) VehicleInfo[vehicleid][mod12] = componentid;
            for(new s=0; s<1; s++) if(componentid == base[s][0]) VehicleInfo[vehicleid][mod13] = componentid;
            for(new s=0; s<4; s++) if(componentid == rbbars[s][0]) VehicleInfo[vehicleid][mod14] = componentid;
            for(new s=0; s<2; s++) if(componentid == fbbars[s][0]) VehicleInfo[vehicleid][mod15] = componentid;
            for(new s=0; s<17; s++) if(componentid == wheels[s][0]) VehicleInfo[vehicleid][mod16] = componentid;
            for(new s=0; s<2; s++) if(componentid == lights[s][0]) VehicleInfo[vehicleid][mod17] = componentid;
        }
    }
    return 1;
}
Reply
#5

usei isso,e depois fiz igual ao wiki do SAMP,ams deu-me isto ao compilar:
pawn Код:
C:\Users\Jesus\Desktop\OG\pawno\include\a_players.inc(125) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYER_ATTACHED_OBJECTS")
C:\Users\Jesus\Desktop\OG\pawno\include\JunkBuster.inc(1084) : warning 209: function "F_SetPlayerPos" should return a value
C:\Users\Jesus\Desktop\OG\pawno\include\JunkBuster.inc(3126) : warning 201: redefinition of constant/macro (symbol "SetPlayerPos")
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(20318) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(37715) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38495) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38502) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38509) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38516) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38523) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38537) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38544) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38551) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(38558) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(45127) : warning 219: local variable "strout" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(45127) : warning 219: local variable "out" shadows a variable at a preceding level
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(52297) : error 025: function heading differs from prototype
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(55335) : warning 203: symbol is never used: "out"
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(55335) : warning 203: symbol is never used: "strout"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Linha do erro
pawn Код:
public OnVehicleMod(vehicleid,componentid)
public inteira
pawn Код:
public OnVehicleMod(vehicleid,componentid)
{
    SaveComponent(vehicleid, componentid);
    return 1;
}
Reply
#6

noop meu minino, sua public ta escrita feia.

assim й mai buito
Код:
public OnVehicleMod(playerid,vehicleid,componentid)
e akele monte de warning, ta dizend q tm variavel repitida, sу tira tds, e deixar sу a primeira.

Код:
warning 219: local variable "strout" shadows a variable at a preceding level
e esses...

nгo tenho certeza mais acho q vc tm q deletar a variavel , new out; e new strout;

Код:
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(55335) : warning 203: symbol is never used: "out"
C:\Users\Jesus\Desktop\OG\gamemodes\OG-RP.pwn(55335) : warning 203: symbol is never used: "strout"
Reply
#7

sim,obrigado mas tipo eu tenho o tunning em dialog,e agora eu meti assim(um exemplo)
pawn Код:
if(pmodelid[playerid] == 562)
                        {
                            AddVehicleComponent(car,1034);
                            AddComponent(car,1034);
                            GivePlayerEuros(playerid, -2500);
                            PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
                            SendClientMessage(playerid,COLOR_WHITE," Adicionaste um componente com sucesso no teu elegy! (Wheel Arch Alien Escape).");
                            ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, "Seleciona um Escape", "Wheel Arch Alien Escape\nWheel Arch X-Flow Escape\nLocos Low Chromer Escape\nLocos Low Slamin Escape\nVoltar", "Selecionar", "Sair");
                            SaveComponent(vehicleid, componentid);
                        }
so que da erro,diz que nao consegue ler ou uam cena parecida o "componentid" Erro:
pawn Код:
error 017: undefined symbol "componentid"
Reply
#8

agora vamos dar um grande salto para cima meu pequeno amiguinho de 2 pernas

Em cima do GM:

Код:
 

new componentid;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)