[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


Messages In This Thread
Converter para ZCMD - by sonmook - 06.01.2015, 03:53
Re: Converter para ZCMD - by Bruno13 - 06.01.2015, 05:22
Re: Converter para ZCMD - by WLSF - 06.01.2015, 10:27
Re: Converter para ZCMD - by sonmook - 06.01.2015, 12:23
Re: Converter para ZCMD - by [BOPE]Seu._.Madruga - 06.01.2015, 16:15

Forum Jump:


Users browsing this thread: 1 Guest(s)