/veh - /carcomponent
#1

Hey guys how can i change miЎy code to zcmd?

PHP код:
if(strcmp(cmd"/veh"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if (
PlayerInfo[playerid][pAdmin] < 2)
            {
                
SendClientMessage(playeridCOLOR_GRAD"You are not authorized to use that command!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD"USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
                return 
1;
            }
            new 
car;
            
car strval(tmp);
            if(
car 400 || car 611) { SendClientMessage(playeridCOLOR_GRAD"   Vehicle Number can't be below 400 or above 611 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD"USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
                return 
1;
            }
            new 
color1;
            
color1 strval(tmp);
            if(
color1 || color1 126) { SendClientMessage(playeridCOLOR_GRAD"   Color Number can't be below 0 or above 126 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
                return 
1;
            }
            new 
color2;
            
color2 strval(tmp);
            if(
color2 || color2 255) { SendClientMessage(playeridCOLOR_GREY"   Color Number can't be below 0 or above 255 !"); return 1; }
            new 
Float:X,Float:Y,Float:Z;
            
GetPlayerPos(playeridX,Y,Z);
            new 
carid CreateVehicle(carX+4,Y,Z0.0color1color212000);
            
CreatedCars[CreatedCar] = carid;
            
PutPlayerInVehicle(playeridcarid0);
            
CreatedCar ++;
            
format(stringsizeof(string), "   Vehicle %d spawned."carid);
            
SendClientMessage(playeridCOLOR_GREYstring);
        }
        return 
1;
    }
if(
strcmp(cmd"/addcomponent"true) == 0
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] > 3)
            {
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"USAGE: /addcomponent [ComponentID]");
                    return 
1;
                }
                if(!
IsPlayerInAnyVehicle(playerid))
                {
                    
SendClientMessage(playeridCOLOR_GREY"  You are not in a vehicle!");
                    return 
1;
                }
                {
                    new 
componentid;
                    
componentid strval(tmp);
                    new 
CarId GetPlayerVehicleID(playerid);
                    if(
componentid 1000 || componentid 1193) { SendClientMessage(playeridCOLOR_GREY"   Component ID can't be below 1000 or above 1193 !"); return 1; }
                    
AddVehicleComponent(CarIdcomponentid);
                    
SendClientMessage(playeridCOLOR_GREEN" Type /carcomponents for more info!");
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREEN" You are not an Admin.");
                return 
1;
            }
        }
        return 
1;
    }
if(
strcmp(cmd"/carcomponents"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] > 3)
            {
                
SendClientMessage(playeridCOLOR_WHITE" Car Components List");
                
SendClientMessage(playeridCOLOR_GREEN" Transfenders spoilers - 1000 - 1003");
                
SendClientMessage(playeridCOLOR_GREEN" Roof - 1006");
                
SendClientMessage(playeridCOLOR_GREEN" x10 Nos - 1010");
                
SendClientMessage(playeridCOLOR_GREEN" Shadow Rims - 1073");
                
SendClientMessage(playeridCOLOR_GREEN" Mega Rims - 1074");
                
SendClientMessage(playeridCOLOR_GREEN" Rimshine Rims- 1075");
                
SendClientMessage(playeridCOLOR_GREEN" Wires Rims - 1076");
                
SendClientMessage(playeridCOLOR_GREEN" Classic Rims - 1077");
                
SendClientMessage(playeridCOLOR_GREEN" Twist Rims - 1078");
                
SendClientMessage(playeridCOLOR_GREEN" Cutter Rims - 1079");
                
SendClientMessage(playeridCOLOR_GREEN" Switch Rims - 1080");
                
SendClientMessage(playeridCOLOR_GREEN" Grove Rims - 1081");
                
SendClientMessage(playeridCOLOR_GREEN" Import Rims - 1082");
                
SendClientMessage(playeridCOLOR_GREEN" Dollar Rims - 1083");
                
SendClientMessage(playeridCOLOR_GREEN" Trance Rims - 1084");
                
SendClientMessage(playeridCOLOR_GREEN" Atomic Rims - 1085");
                
SendClientMessage(playeridCOLOR_GREEN" Hydraulics - 1087");
                
SendClientMessage(playeridCOLOR_GREEN" Uranus Spoiler - 1063 - 1064");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREEN" You are not an Admin.");
                return 
1;
            }
        }
        return 
1;
    } 
Also can u explaint me please? cuz i read a guide but i still understand
Reply
#2

Check out these https://sampforum.blast.hk/showthread.php?tid=280282 | https://sampforum.blast.hk/showthread.php?tid=280387
Reply
#3

Ahhh help pls i dont understand T_T
Reply
#4

Код:
You also gotta include sscanf along with zcmd.
PHP код:
CMD:veh(playeridparams[])
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if (
PlayerInfo[playerid][pAdmin] < 2
            { 
                
SendClientMessage(playeridCOLOR_GRAD"You are not authorized to use that command!"); 
                return 
1
            } 
            new 
carcolor1color2;
            if(
sscanf(params"iii"carcolor1color2)) 
            { 
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]"); 
                return 
1
            } 
            
            if(
car 400 || car 611) { SendClientMessage(playeridCOLOR_GRAD"   Vehicle Number can't be below 400 or above 611 !"); return 1; } 
            
            if(
color1 || color1 126) { SendClientMessage(playeridCOLOR_GRAD"   Color Number can't be below 0 or above 126 !"); return 1; } 
    
            if(
color2 || color2 255) { SendClientMessage(playeridCOLOR_GREY"   Color Number can't be below 0 or above 255 !"); return 1; } 
            new 
Float:X,Float:Y,Float:Z
            
GetPlayerPos(playeridX,Y,Z); 
            new 
carid CreateVehicle(carX+4,Y,Z0.0color1color212000); 
            
CreatedCars[CreatedCar] = carid
            
PutPlayerInVehicle(playeridcarid0); 
            
CreatedCar ++; 
            
format(stringsizeof(string), "   Vehicle %d spawned."carid); 
            
SendClientMessage(playeridCOLOR_GREYstring); 
        } 
        return 
1
    } 
CMD:addcomponent(playeridparams[]) 
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if(
PlayerInfo[playerid][pAdmin] > 3
            { 
                 new 
componentid
                
                if(
sscanf(params"i"componentid)) 
                { 
                    
SendClientMessage(playeridCOLOR_GRAD1"USAGE: /addcomponent [ComponentID]"); 
                    return 
1
                } 
                if(!
IsPlayerInAnyVehicle(playerid)) 
                { 
                    
SendClientMessage(playeridCOLOR_GREY"  You are not in a vehicle!"); 
                    return 
1
                } 
                    new 
CarId GetPlayerVehicleID(playerid); 
                    if(
componentid 1000 || componentid 1193) { SendClientMessage(playeridCOLOR_GREY"   Component ID can't be below 1000 or above 1193 !"); return 1; } 
                    
AddVehicleComponent(CarIdcomponentid); 
                    
SendClientMessage(playeridCOLOR_GREEN" Type /carcomponents for more info!"); 
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREEN" You are not an Admin."); 
                return 
1
            } 
        } 
        return 
1
    } 
CMD:carcomponents(playeridparams[])
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if(
PlayerInfo[playerid][pAdmin] > 3
            { 
                
SendClientMessage(playeridCOLOR_WHITE" Car Components List"); 
                
SendClientMessage(playeridCOLOR_GREEN" Transfenders spoilers - 1000 - 1003"); 
                
SendClientMessage(playeridCOLOR_GREEN" Roof - 1006"); 
                
SendClientMessage(playeridCOLOR_GREEN" x10 Nos - 1010"); 
                
SendClientMessage(playeridCOLOR_GREEN" Shadow Rims - 1073"); 
                
SendClientMessage(playeridCOLOR_GREEN" Mega Rims - 1074"); 
                
SendClientMessage(playeridCOLOR_GREEN" Rimshine Rims- 1075"); 
                
SendClientMessage(playeridCOLOR_GREEN" Wires Rims - 1076"); 
                
SendClientMessage(playeridCOLOR_GREEN" Classic Rims - 1077"); 
                
SendClientMessage(playeridCOLOR_GREEN" Twist Rims - 1078"); 
                
SendClientMessage(playeridCOLOR_GREEN" Cutter Rims - 1079"); 
                
SendClientMessage(playeridCOLOR_GREEN" Switch Rims - 1080"); 
                
SendClientMessage(playeridCOLOR_GREEN" Grove Rims - 1081"); 
                
SendClientMessage(playeridCOLOR_GREEN" Import Rims - 1082"); 
                
SendClientMessage(playeridCOLOR_GREEN" Dollar Rims - 1083"); 
                
SendClientMessage(playeridCOLOR_GREEN" Trance Rims - 1084"); 
                
SendClientMessage(playeridCOLOR_GREEN" Atomic Rims - 1085"); 
                
SendClientMessage(playeridCOLOR_GREEN" Hydraulics - 1087"); 
                
SendClientMessage(playeridCOLOR_GREEN" Uranus Spoiler - 1063 - 1064"); 
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREEN" You are not an Admin."); 
                return 
1
            } 
        } 
        return 
1
    } 
Reply
#5

Код:
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1512) : error 017: undefined symbol "string"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1512) : error 017: undefined symbol "string"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1512) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1512) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors

C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1508) : error 017: undefined symbol "CreatedCars"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1508) : error 017: undefined symbol "CreatedCar"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1508) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1508) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

replace this
PHP код:
            new Float:X,Float:Y,Float:Z
with this
PHP код:
            new Float:X,Float:Y,Float:Z,string[128]; 
+rep if i helped
Reply
#7

dont work
Reply
#8

Show the lines in which you are getting errors.
Reply
#9

Код:
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1509) : error 017: undefined symbol "CreatedCars"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1509) : error 017: undefined symbol "CreatedCar"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1509) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1509) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
line 1506 to 1513

PHP код:
new Float:X,Float:Y,Float:Z;
            
GetPlayerPos(playeridX,Y,Z);
            new 
carid CreateVehicle(carX+4,Y,Z0.0color1color212000);
            
CreatedCars[CreatedCar] = carid;
            
PutPlayerInVehicle(playeridcarid0);
            
CreatedCar ++;
            
format(stringsizeof(string), "   Vehicle %d spawned."carid);
            
SendClientMessage(playeridCOLOR_GREYstring); 
Reply
#10

Anyone can help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)