[Ajuda] Converter para ZCMD
#1

Galera como converteria esses cmd's para Zcmd ?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128],tmp[128],idx;
    cmd = strtok(cmdtext,idx);
    new string[256];
    new vehicleid = GetPlayerVehicleID(playerid);
    new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new giveplayerid;
    if(strcmp(cmd, "/v", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new x_nr[64];
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid, COLOR_GREY, "HINT: (/v)ehicle [name]");
                SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lockmycar, unlockmycar, locate");
                return 1;
            }
            if(strcmp(x_nr,"lockmycar",true) == 0)
            {
                new keycar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
                new personalcar = (DOF2_GetInt(PFile(playerid),"CarID"));
                if(keycar == 1)
                {
                    new locked[256];
                    locked = strtok(cmdtext, idx);
                    if (VehicleSystem[GetCreatorID(personalcar)][cLock]==1)
                    {
                        for(new i = 0; i < SLOTS; i++)
                        {
                            if (IsPlayerConnected(i))
                            {
                                SetVehicleParamsForPlayer(personalcar,i,0,1);
                            }
                        }
                        format(string, sizeof(string), "~w~Vehicle~n~~g~Locked");
                        GameTextForPlayer(playerid, string, 4000, 3);
                        VehicleSystem[GetCreatorID(personalcar)][cLock]=0;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string,sizeof(string), "* %s has locked his personal vehicle, using his car key!", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SaveTool();
                        return 1;
                    }
                }
            }
            else if(strcmp(x_nr,"unlockmycar",true) == 0)
            {
                new keycar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
                new personalcar = (DOF2_GetInt(PFile(playerid),"CarID"));
                if(keycar == 1)
                {
                    new locked[256];
                    locked = strtok(cmdtext, idx);
                    if (VehicleSystem[GetCreatorID(vehicleid)][cLock]==0)
                    {
                        for(new i = 0; i < SLOTS; i++)
                        {
                            if (IsPlayerConnected(i))
                            {
                                SetVehicleParamsForPlayer(personalcar,i,0,0);
                            }
                        }
                        format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
                        GameTextForPlayer(playerid, string, 4000, 3);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string,sizeof(string), "* %s has unlocked his personal vehicle, using his car key!", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        VehicleSystem[GetCreatorID(personalcar)][cLock]=1;
                        SaveTool();
                        return 1;
                    }
                }
            }
            else if(strcmp(x_nr,"park",true) == 0)
            {
                if(!IsPlayerInAnyVehicle(playerid)){return 1;}
                if(GetCreatorID(vehicleid)!=0)
                {
                    if (strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid)))
                    {
                        new Float:vx,Float:vy,Float:vz,Float:va;
                        GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
                        GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
                        VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
                        VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
                        VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
                        VehicleSystem[GetCreatorID(vehicleid)][a]=va;
                        SetVehicleHealth(GetPlayerVehicleID(playerid),100.0);
                        SendClientMessage(playerid,WHITE,"You have parked your vehicle here!");
                        SendClientMessage(playerid,YELLOW,"Your vehicle will now respawn here!");
                        SaveTool();
                    }
                }
                return 1;
            }
            else if(strcmp(x_nr,"locate",true) == 0)
            {
                if(!IsPlayerConnected(playerid)) { return 1; }
                new Float:xxx,Float:yyy,Float:zzz;
                new keycar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
                new personalcar = (DOF2_GetInt(PFile(playerid),"CarID"));
                if(keycar == 0) { GameTextForPlayer(playerid, "~w~You haven's got a car to find", 2500, 3); return 1; }
                SendClientMessage(playerid,COLOR_WHITE,"Your car has been found!");
                GetVehiclePos(personalcar, xxx, yyy, zzz);
                SetPlayerCheckpoint(playerid, xxx, yyy, zzz, 6);
                return 1;
            }
        }
        return 1;
    }

    if (strcmp(cmd, "/removeveh", true) ==0 )
    {
        if(!IsPlayerInAnyVehicle(playerid)){return 1;}
        if(!IsPlayerAdmin(playerid)){return 1;}
        VehicleSystem[GetCreatorID(vehicleid)][model]=0;
        VehicleSystem[GetCreatorID(vehicleid)][owned]=0;
        VehicleSystem[GetCreatorID(vehicleid)][x]=(0.0);
        VehicleSystem[GetCreatorID(vehicleid)][y]=(0.0);
        VehicleSystem[GetCreatorID(vehicleid)][z]=(0.0);
        VehicleSystem[GetCreatorID(vehicleid)][Farbe1]=0;
        VehicleSystem[GetCreatorID(vehicleid)][Farbe2]=0;
        VehicleSystem[GetCreatorID(vehicleid)][preis]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod1]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod2]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod3]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod4]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod5]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod6]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod7]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod8]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod9]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod10]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod11]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod12]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod13]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod14]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod15]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod16]=0;
        VehicleSystem[GetCreatorID(vehicleid)][mod17]=0;
        VehicleSystem[GetCreatorID(vehicleid)][paintjob]=0;
        VehicleSystem[GetCreatorID(vehicleid)][cLock]=1;
        strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"",0,128,128);
        IDIS[vehicleid]=0;
        DestroyVehicle(vehicleid);
        SaveTool();
        return 1;
    }
    if (strcmp(cmd, "/newbuycar", true) ==0 )
    {
        if(!IsPlayerAdmin(playerid)){return 1;}
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)){return 1;}
        new vehiclemodel = strval(tmp);
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)){return 1;}
        new color1 = strval(tmp);
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)){return 1;}
        new color2 = strval(tmp);
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)){return 1;}
        new price = strval(tmp);
        new Float:px,Float:py,Float:pz,Float:pa;
        GetPlayerPos(playerid,px,py,pz);
        GetPlayerFacingAngle(playerid,pa);
        created++;
        VehicleSystem[created][model]=vehiclemodel;
        VehicleSystem[created][x]=px;
        VehicleSystem[created][y]=py;
        VehicleSystem[created][z]=pz;
        VehicleSystem[created][a]=pa;
        VehicleSystem[created][Farbe1]=color1;
        VehicleSystem[created][Farbe2]=color2;
        VehicleSystem[created][preis]=price;
        VehicleSystem[created][owned]=0;
        VehicleSystem[created][cLock]=1;
        strmid(VehicleSystem[created][owner],"dealercar",0,128,128);
        new ccar = CreateVehicle(VehicleSystem[created][model],VehicleSystem[created][x],VehicleSystem[created][y],VehicleSystem[created][z],VehicleSystem[created][a],VehicleSystem[created][Farbe1],VehicleSystem[created][Farbe2],600000);
        IDIS[ccar]=created;
        SaveTool();
        return 1;
    }
    if (strcmp(cmd, "/buyveh", true) ==0 )
    {
        /*if(DOF2_GetInt(PFile(playerid),"HaveCar")== 1) return SendClientMessage(playerid,ORANGE,"[ERROR]You already have a Car");*/
        /*if(DOF2_GetInt(PFile(playerid),"HaveCar")== 1) { }
        else { SendClientMessage(playerid, ORANGE,"[ERROR]You already have a Car"); return 1; }*/

        new HaveCar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
        if(!IsPlayerInAnyVehicle(playerid)){return 1;}
        if(GetCreatorID(vehicleid)!=0)
        {
            if(HaveCar == 0)
            {
                if (strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid))){SendClientMessage(playerid,WHITE," Aceasta masina este deja cumparata!");return 1;}
                if (strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar"))
                {
                    if(VehicleSystem[GetCreatorID(vehicleid)][preis] < GetPlayerMoney(playerid))
                    {
                        strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid),0,128,128);
                        VehicleSystem[GetCreatorID(vehicleid)][owned]=1;
                        SetVehicleNumberPlate(vehicleid, VehicleSystem[GetCreatorID(vehicleid)][owner]);
                        GivePlayerMoney(playerid,-VehicleSystem[GetCreatorID(vehicleid)][preis]);
                        SendClientMessage(playerid,YELLOW," Congratulations with your new purchase!");
                        SendClientMessage(playerid,WHITE," You can see your personal car commands by using /carhelp");
                        TogglePlayerControllable(playerid,1);
                        Delete3DTextLabel(TextUpCar[vehicleid]);
                        SaveTool();
                    }
                    else
                    {
                        SendClientMessage(playerid,WHITE,"You don't have enough cash with you!");
                    }
                }
                else
                {
                    SendClientMessage(playerid,WHITE,"This car is not for sale!");
                }
            }
            else
            {
                SendClientMessage(playerid, ORANGE,"[ERROR]You already have a Car");
            }
        }
        else
        {
            SendClientMessage(playerid,WHITE,"It's not for sale!");
        }
        if(!DOF2_FileExists(PFile(playerid)))
        {
            DOF2_CreateFile(PFile(playerid));
            DOF2_SetInt(PFile(playerid),"HaveCar",1);
            DOF2_SetInt(PFile(playerid),"CarID",vehicleid);
        }
        else if(DOF2_FileExists(PFile(playerid)))
        {
            DOF2_SetInt(PFile(playerid),"HaveCar",1);
            DOF2_SetInt(PFile(playerid),"CarID",vehicleid);
        }
        return 1;
    }

    if (strcmp(cmd, "/sellveh", true) ==0)
    {
        if(!IsPlayerInAnyVehicle(playerid)){return 1;}
        if(GetCreatorID(vehicleid)!=0)
        {
            if (IsPlayerAdmin(playerid))
            {
                tmp = strtok(cmdtext,idx);
                if(!strlen(tmp)){SendClientMessage(playerid,WHITE,"INFO: /sellveh [price]");return 1;}
                new Float:vx,Float:vy,Float:vz,Float:va;
                GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
                GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
                VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
                VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
                VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
                VehicleSystem[GetCreatorID(vehicleid)][a]=va;
                VehicleSystem[GetCreatorID(vehicleid)][preis]=strval(tmp);
                VehicleSystem[GetCreatorID(vehicleid)][owned]=0;
                VehicleSystem[GetCreatorID(vehicleid)][cLock]=1;
                strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128);
                SendClientMessage(playerid,WHITE,"This Car Is Now For Sale!");
                SaveTool();
                Delete3DTextLabel(TextUpCar[vehicleid]);
                format(TextCar,sizeof(TextCar),"This car is for sale, price: %d",VehicleSystem[GetCreatorID(vehicleid)][preis]);
                TextUpCar[vehicleid] = Create3DTextLabel(TextCar, 0xFFFFFFAA ,0,0,0,20.0,0);
                Attach3DTextLabelToVehicle(TextUpCar[vehicleid],vehicleid,0.0,0.0,0.0);
            }
            else
            {
                SendClientMessage(playerid,WHITE,"INFO: Nu esti admin ca sa poti vinde masini!");
            }
        }
        return 1;
    }
    if (strcmp(cmd, "/apark", true) ==0 )
    {
        if(!IsPlayerInAnyVehicle(playerid)){return 1;}
        if(!IsPlayerAdmin(playerid)){return 1;}
        if(GetCreatorID(vehicleid)!=0)
        {
            new Float:vx,Float:vy,Float:vz,Float:va;
            GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
            VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
            VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
            VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
            VehicleSystem[GetCreatorID(vehicleid)][a]=va;
            SendClientMessage(playerid,WHITE,"Admin Park!");
            SaveTool();
        }
        else
        {
            SendClientMessage(playerid,WHITE," You Can't Park This Car!");
        }
        return 1;
    }
    if (strcmp(cmd, "/exitcar", true) ==0 )
    {
        if(!IsPlayerInAnyVehicle(playerid)){return 1;}
        if(GetCreatorID(vehicleid)!=0)
        {
            TogglePlayerControllable(playerid, 1);
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }
    if(strcmp(cmd, "/carhelp", true) == 0)
    {
        SendClientMessage(playerid, 0x33AA33AA, "_______________________________________");
        SendClientMessage(playerid, 0xFFFFFFAA, "*** HELP *** Your Vehicle Commands");
        SendClientMessage(playerid, 0xCBCCCEFF, "*** CAR *** type /v to view your personal car commands!");
        return 1;
    }
    if (strcmp(cmd, "/deleteowner", true)==0)
    {
        if ((IsPlayerAdmin(playerid)))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, WHITE, "USAGE: /deleteowner [PlayerName]");
                return 1;
            }
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));

            format(string,sizeof(string),"Users/%s.ini",tmp);
            DOF2_RemoveFile(string);
            SendClientMessage(playerid, ORANGE, "Car Owner Deleted");
        }
        return 1;
    }
    return 0;
}
Reply
#2

Aconselharia a usar sscanf em troca de strtok onde hб os parвmetros jб que queres usar zcmd...

Veja esse tutorial: https://sampforum.blast.hk/showthread.php?tid=277842
Reply
#3

Quote:
Originally Posted by sonmook
Посмотреть сообщение
Galera como converteria esses cmd's para Zcmd ?
Vocк vai precisar de conhecimento sobre oque os comandos estгo fazendo, e conhecimento sobre como utilizar ZCMD com SSCANF.


Abraзos.
Reply
#4

Vejam se estб correto principalmente o Primeiro CMD.
pawn Код:
CMD:v(playerid, params[]) {
    if(IsPlayerConnected(playerid))
    {
        new x_nr[64];
        new tmp;
        if(sscanf(params, "d", tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "HINT: (/v)ehicle [name]");
            SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lockmycar, unlockmycar, locate");
            return 1;
        }
        if(strcmp(x_nr,"lockmycar",true) == 0)
        {
            new keycar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
            new personalcar = (DOF2_GetInt(PFile(playerid),"CarID"));
            if(keycar == 1)
            {
                new locked[256];
                locked = strtok(cmdtext, idx);
                if (VehicleSystem[GetCreatorID(personalcar)][cLock]==1)
                {
                    for(new i = 0; i < SLOTS; i++)
                    {
                        if (IsPlayerConnected(i))
                        {
                            SetVehicleParamsForPlayer(personalcar,i,0,1);
                        }
                    }
                    format(string, sizeof(string), "~w~Vehicle~n~~g~Locked");
                    GameTextForPlayer(playerid, string, 4000, 3);
                    VehicleSystem[GetCreatorID(personalcar)][cLock]=0;
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string,sizeof(string), "* %s has locked his personal vehicle, using his car key!", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SaveTool();
                    return 1;
                }
            }
        }
        else if(strcmp(x_nr,"unlockmycar",true) == 0)
        {
            new keycar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
            new personalcar = (DOF2_GetInt(PFile(playerid),"CarID"));
            if(keycar == 1)
            {
                new locked[256];
                locked = strtok(cmdtext, idx);
                if (VehicleSystem[GetCreatorID(vehicleid)][cLock]==0)
                {
                    for(new i = 0; i < SLOTS; i++)
                    {
                        if (IsPlayerConnected(i))
                        {
                            SetVehicleParamsForPlayer(personalcar,i,0,0);
                        }
                    }
                    format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
                    GameTextForPlayer(playerid, string, 4000, 3);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string,sizeof(string), "* %s has unlocked his personal vehicle, using his car key!", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    VehicleSystem[GetCreatorID(personalcar)][cLock]=1;
                    SaveTool();
                    return 1;
                }
            }
        }
        else if(strcmp(x_nr,"park",true) == 0)
        {
            if(!IsPlayerInAnyVehicle(playerid)){return 1;}
            if(GetCreatorID(vehicleid)!=0)
            {
                if (strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid)))
                {
                    new Float:vx,Float:vy,Float:vz,Float:va;
                    GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
                    GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
                    VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
                    VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
                    VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
                    VehicleSystem[GetCreatorID(vehicleid)][a]=va;
                    SetVehicleHealth(GetPlayerVehicleID(playerid),100.0);
                    SendClientMessage(playerid,WHITE,"You have parked your vehicle here!");
                    SendClientMessage(playerid,YELLOW,"Your vehicle will now respawn here!");
                    SaveTool();
                }
            }
            return 1;
        }
        else if(strcmp(x_nr,"locate",true) == 0)
        {
            if(!IsPlayerConnected(playerid)) { return 1; }
            new Float:xxx,Float:yyy,Float:zzz;
            new keycar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
            new personalcar = (DOF2_GetInt(PFile(playerid),"CarID"));
            if(keycar == 0) { GameTextForPlayer(playerid, "~w~You haven's got a car to find", 2500, 3); return 1; }
            SendClientMessage(playerid,COLOR_WHITE,"Your car has been found!");
            GetVehiclePos(personalcar, xxx, yyy, zzz);
            SetPlayerCheckpoint(playerid, xxx, yyy, zzz, 6);
            return 1;
        }
    }
    return 1;
}

CMD:removeveh(playerid) {
    if(!IsPlayerInAnyVehicle(playerid)){return 1;}
    if(!IsPlayerAdmin(playerid)){return 1;}
    VehicleSystem[GetCreatorID(vehicleid)][model]=0;
    VehicleSystem[GetCreatorID(vehicleid)][owned]=0;
    VehicleSystem[GetCreatorID(vehicleid)][x]=(0.0);
    VehicleSystem[GetCreatorID(vehicleid)][y]=(0.0);
    VehicleSystem[GetCreatorID(vehicleid)][z]=(0.0);
    VehicleSystem[GetCreatorID(vehicleid)][Farbe1]=0;
    VehicleSystem[GetCreatorID(vehicleid)][Farbe2]=0;
    VehicleSystem[GetCreatorID(vehicleid)][preis]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod1]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod2]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod3]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod4]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod5]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod6]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod7]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod8]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod9]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod10]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod11]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod12]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod13]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod14]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod15]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod16]=0;
    VehicleSystem[GetCreatorID(vehicleid)][mod17]=0;
    VehicleSystem[GetCreatorID(vehicleid)][paintjob]=0;
    VehicleSystem[GetCreatorID(vehicleid)][cLock]=1;
    strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"",0,128,128);
    IDIS[vehicleid]=0;
    DestroyVehicle(vehicleid);
    SaveTool();
    return 1;
}
CMD:newbuycar(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)){return 1;}
    new carro, cor1, cor2, SNAPreco;
    if(sscanf(params, "dddd", carro, cor1, cor2, SNAPreco))
        return SCM(playerid, COR_CINZA1, "Use: /newbuycar [id do carro] [cor 1] [cor 2] [preзo]");
    new price = strval(tmp);
    new Float:px,Float:py,Float:pz,Float:pa;
    GetPlayerPos(playerid,px,py,pz);
    GetPlayerFacingAngle(playerid,pa);
    created++;
    VehicleSystem[created][model]=vehiclemodel;
    VehicleSystem[created][x]=px;
    VehicleSystem[created][y]=py;
    VehicleSystem[created][z]=pz;
    VehicleSystem[created][a]=pa;
    VehicleSystem[created][Farbe1]=color1;
    VehicleSystem[created][Farbe2]=color2;
    VehicleSystem[created][preis]=price;
    VehicleSystem[created][owned]=0;
    VehicleSystem[created][cLock]=1;
    strmid(VehicleSystem[created][owner],"dealercar",0,128,128);
    new ccar = CreateVehicle(VehicleSystem[created][model],VehicleSystem[created][x],VehicleSystem[created][y],VehicleSystem[created][z],VehicleSystem[created][a],VehicleSystem[created][Farbe1],VehicleSystem[created][Farbe2],600000);
    IDIS[ccar]=created;
    SaveTool();
    return 1;
}
CMD:buyveh(playerid) {
    /*if(DOF2_GetInt(PFile(playerid),"HaveCar")== 1) return SendClientMessage(playerid,ORANGE,"[ERROR]You already have a Car");*/
    /*if(DOF2_GetInt(PFile(playerid),"HaveCar")== 1) { }
    else { SendClientMessage(playerid, ORANGE,"[ERROR]You already have a Car"); return 1; }*/

    new HaveCar = (DOF2_GetInt(PFile(playerid),"HaveCar"));
    if(!IsPlayerInAnyVehicle(playerid)){return 1;}
    if(GetCreatorID(vehicleid)!=0)
    {
        if(HaveCar == 0)
        {
            if (strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid))){SendClientMessage(playerid,WHITE," Aceasta masina este deja cumparata!");return 1;}
            if (strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar"))
            {
                if(VehicleSystem[GetCreatorID(vehicleid)][preis] < GetPlayerMoney(playerid))
                {
                    strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid),0,128,128);
                    VehicleSystem[GetCreatorID(vehicleid)][owned]=1;
                    SetVehicleNumberPlate(vehicleid, VehicleSystem[GetCreatorID(vehicleid)][owner]);
                    GivePlayerMoney(playerid,-VehicleSystem[GetCreatorID(vehicleid)][preis]);
                    SendClientMessage(playerid,YELLOW," Congratulations with your new purchase!");
                    SendClientMessage(playerid,WHITE," You can see your personal car commands by using /carhelp");
                    TogglePlayerControllable(playerid,1);
                    Delete3DTextLabel(TextUpCar[vehicleid]);
                    SaveTool();
                }
                else
                {
                    SendClientMessage(playerid,WHITE,"You don't have enough cash with you!");
                }
            }
            else
            {
                SendClientMessage(playerid,WHITE,"This car is not for sale!");
            }
        }
        else
        {
            SendClientMessage(playerid, ORANGE,"[ERROR]You already have a Car");
        }
    }
    else
    {
        SendClientMessage(playerid,WHITE,"It's not for sale!");
    }
    if(!DOF2_FileExists(PFile(playerid)))
    {
        DOF2_CreateFile(PFile(playerid));
        DOF2_SetInt(PFile(playerid),"HaveCar",1);
        DOF2_SetInt(PFile(playerid),"CarID",vehicleid);
    }
    else if(DOF2_FileExists(PFile(playerid)))
    {
        DOF2_SetInt(PFile(playerid),"HaveCar",1);
        DOF2_SetInt(PFile(playerid),"CarID",vehicleid);
    }
    return 1;
}

CMD:sellveh(playerid, params[]) {
    if(!IsPlayerInAnyVehicle(playerid)){return 1;}
    if(GetCreatorID(vehicleid)!=0)
    {
        if (IsPlayerAdmin(playerid))
        {
            new SNAPrice;
            if(sscanf(params, "d",SNAPrice))
                return SCM(playerid, COR_CINZA1, "Use: /sellveh [price]");
            new Float:vx,Float:vy,Float:vz,Float:va;
            GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
            VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
            VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
            VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
            VehicleSystem[GetCreatorID(vehicleid)][a]=va;
            VehicleSystem[GetCreatorID(vehicleid)][preis]=strval(tmp);
            VehicleSystem[GetCreatorID(vehicleid)][owned]=0;
            VehicleSystem[GetCreatorID(vehicleid)][cLock]=1;
            strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128);
            SendClientMessage(playerid,WHITE,"This Car Is Now For Sale!");
            SaveTool();
            Delete3DTextLabel(TextUpCar[vehicleid]);
            format(TextCar,sizeof(TextCar),"This car is for sale, price: %d",VehicleSystem[GetCreatorID(vehicleid)][preis]);
            TextUpCar[vehicleid] = Create3DTextLabel(TextCar, 0xFFFFFFAA ,0,0,0,20.0,0);
            Attach3DTextLabelToVehicle(TextUpCar[vehicleid],vehicleid,0.0,0.0,0.0);
        }
        else
        {
            SendClientMessage(playerid,WHITE,"INFO: Nu esti admin ca sa poti vinde masini!");
        }
    }
    return 1;
}
CMD:apark(playerid) {
    if(!IsPlayerInAnyVehicle(playerid)){return 1;}
    if(!IsPlayerAdmin(playerid)){return 1;}
    if(GetCreatorID(vehicleid)!=0)
    {
        new Float:vx,Float:vy,Float:vz,Float:va;
        GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
        GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
        VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
        VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
        VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
        VehicleSystem[GetCreatorID(vehicleid)][a]=va;
        SendClientMessage(playerid,WHITE,"Admin Park!");
        SaveTool();
    }
    else
    {
        SendClientMessage(playerid,WHITE," You Can't Park This Car!");
    }
    return 1;
}
CMD:exitcar(playerid) {
    if(!IsPlayerInAnyVehicle(playerid)){return 1;}
    if(GetCreatorID(vehicleid)!=0)
    {
        TogglePlayerControllable(playerid, 1);
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
CMD:carhelp(playerid) {
    SendClientMessage(playerid, 0x33AA33AA, "_______________________________________");
    SendClientMessage(playerid, 0xFFFFFFAA, "*** HELP *** Your Vehicle Commands");
    SendClientMessage(playerid, 0xCBCCCEFF, "*** CAR *** type /v to view your personal car commands!");
    return 1;
}
CMD:deleteowner(playerid, params[]) {
    if ((IsPlayerAdmin(playerid)))
    {
        if(sscanf(params, "u", iddele))
            return SCM(playerid, COR_CINZA, "Use: /deleteowner [id]");
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string,sizeof(string),"Users/%s.ini",tmp);
        DOF2_RemoveFile(string);
        SendClientMessage(playerid, ORANGE, "Car Owner Deleted");
    }
    return 1;
}
Reply
#5

Sу ajudei em alguns, e ainda foi pelo celular, Porйm se der algum erro poste aqui.

PHP код:
CMD:deleteowner(playeridparams[]) {
    new 
string[155], file[155];
    if(
sscanf2(params"s"params)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}use: /deleteowner [PlayerName]");
    
format(filesizeof(file), "Users/%s.ini"params);
    if(!
DOF2_FileExists(file)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}Este Car Owner nгo existe!");
    
format(stringsizeof(string), "Car Owner deleted");
    
SendClientMessage(playerid, -1string);
    
DOF2_RemoveFile(file);
    return 
1;
}
CMD:carhelp(playerid) {
    
SendClientMessage(playerid0x33AA33AA"_______________________________________");
      
SendClientMessage(playerid0xFFFFFFAA"*** HELP *** Your Vehicle Commands");
    
SendClientMessage(playerid0xCBCCCEFF"*** CAR *** type /v to view your personal car commands!");
    return 
1;
}
CMD:exitcar(playerid) {
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}Vocк nгo estб dentro de um veнculo!");
      
TogglePlayerControllable(playerid1);
     
RemovePlayerFromVehicle(playerid);
     return 
1;
}
CMD:apark(playerid) {
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}Vocк nгo tem acesso a este comando!");
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}Vocк nгo estб dentro de um veнculo!");
      new 
Float:pos[4];
       
GetVehiclePos(GetPlayerVehicleID(playerid),pos[0],pos[1],pos[2]);
      
GetVehicleZAngle(GetPlayerVehicleID(playerid),pos[3]);
      
VehicleSystem[GetCreatorID(vehicleid)][x]=pos[0];
       
VehicleSystem[GetCreatorID(vehicleid)][y]=pos[1];
       
VehicleSystem[GetCreatorID(vehicleid)][z]=pos[2];
      
VehicleSystem[GetCreatorID(vehicleid)][a]=pos[3];
      
SendClientMessage(playerid, -1,"Admin Park!");
      
SaveTool();
    return 
1;
}
CMD:sellveh(playeridparams[]) {
     if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}Vocк nгo estб dentro de um veнculo!");
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"[ ERRO ] {FF0000}Vocк nгo tem acesso a este comando!");
    if(
sscanf2(params"d"params)) return SendClientMessage(playerid, -1,"[ ERRO ] {FF0000}use: /sellveh [price]");
       new 
Float:pos[4];
      
GetVehiclePos(GetPlayerVehicleID(playerid),pos[0],pos[1],pos[2]);
    
GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
    
VehicleSystem[GetCreatorID(vehicleid)][x]=pos[0];
      
VehicleSystem[GetCreatorID(vehicleid)][y]=pos[1];
      
VehicleSystem[GetCreatorID(vehicleid)][z]=pos[2];
      
VehicleSystem[GetCreatorID(vehicleid)][a]=pos[3];
      
VehicleSystem[GetCreatorID(vehicleid)][preis]=strval(params);
      
VehicleSystem[GetCreatorID(vehicleid)][owned]=0;
      
VehicleSystem[GetCreatorID(vehicleid)][cLock]=1;
    
strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128);
     
SendClientMessage(playerid, -1"[INFO] Veiculo colocado a venda!");
      
SaveTool();
     
Delete3DTextLabel(TextUpCar[vehicleid]);
     
format(TextCar,sizeof(TextCar),"This car is for sale, price: %d",VehicleSystem[GetCreatorID(vehicleid)][preis]);
    
TextUpCar[vehicleid] = Create3DTextLabel(TextCar0xFFFFFFAA ,0,0,0,20.0,0);
      
Attach3DTextLabelToVehicle(TextUpCar[vehicleid],vehicleid,0.0,0.0,0.0);
      return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)