/veh - /carcomponent -
Jaua10 - 02.10.2017
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(playerid, COLOR_GRAD, "You are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD, "USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GRAD, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD, "USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GRAD, " Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 255 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X+4,Y,Z, 0.0, color1, color2, 12000);
CreatedCars[CreatedCar] = carid;
PutPlayerInVehicle(playerid, carid, 0);
CreatedCar ++;
format(string, sizeof(string), " Vehicle %d spawned.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
if(strcmp(cmd, "/addcomponent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] > 3)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /addcomponent [ComponentID]");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " You are not in a vehicle!");
return 1;
}
{
new componentid;
componentid = strval(tmp);
new CarId = GetPlayerVehicleID(playerid);
if(componentid < 1000 || componentid > 1193) { SendClientMessage(playerid, COLOR_GREY, " Component ID can't be below 1000 or above 1193 !"); return 1; }
AddVehicleComponent(CarId, componentid);
SendClientMessage(playerid, COLOR_GREEN, " Type /carcomponents for more info!");
}
}
else
{
SendClientMessage(playerid, COLOR_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(playerid, COLOR_WHITE, " Car Components List");
SendClientMessage(playerid, COLOR_GREEN, " Transfenders spoilers - 1000 - 1003");
SendClientMessage(playerid, COLOR_GREEN, " Roof - 1006");
SendClientMessage(playerid, COLOR_GREEN, " x10 Nos - 1010");
SendClientMessage(playerid, COLOR_GREEN, " Shadow Rims - 1073");
SendClientMessage(playerid, COLOR_GREEN, " Mega Rims - 1074");
SendClientMessage(playerid, COLOR_GREEN, " Rimshine Rims- 1075");
SendClientMessage(playerid, COLOR_GREEN, " Wires Rims - 1076");
SendClientMessage(playerid, COLOR_GREEN, " Classic Rims - 1077");
SendClientMessage(playerid, COLOR_GREEN, " Twist Rims - 1078");
SendClientMessage(playerid, COLOR_GREEN, " Cutter Rims - 1079");
SendClientMessage(playerid, COLOR_GREEN, " Switch Rims - 1080");
SendClientMessage(playerid, COLOR_GREEN, " Grove Rims - 1081");
SendClientMessage(playerid, COLOR_GREEN, " Import Rims - 1082");
SendClientMessage(playerid, COLOR_GREEN, " Dollar Rims - 1083");
SendClientMessage(playerid, COLOR_GREEN, " Trance Rims - 1084");
SendClientMessage(playerid, COLOR_GREEN, " Atomic Rims - 1085");
SendClientMessage(playerid, COLOR_GREEN, " Hydraulics - 1087");
SendClientMessage(playerid, COLOR_GREEN, " Uranus Spoiler - 1063 - 1064");
}
else
{
SendClientMessage(playerid, COLOR_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
Re: /veh - /carcomponent -
Zeth - 02.10.2017
Check out these
https://sampforum.blast.hk/showthread.php?tid=280282 |
https://sampforum.blast.hk/showthread.php?tid=280387
Re: /veh - /carcomponent -
Jaua10 - 02.10.2017
Ahhh help pls i dont understand T_T
Re: /veh - /carcomponent -
Zeth - 02.10.2017
Код:
You also gotta include sscanf along with zcmd.
PHP код:
CMD:veh(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, COLOR_GRAD, "You are not authorized to use that command!");
return 1;
}
new car, color1, color2;
if(sscanf(params, "iii", car, color1, color2))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [Car ID] [Color ID 1] [Color ID 2]");
return 1;
}
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GRAD, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GRAD, " Color Number can't be below 0 or above 126 !"); return 1; }
if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 255 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X+4,Y,Z, 0.0, color1, color2, 12000);
CreatedCars[CreatedCar] = carid;
PutPlayerInVehicle(playerid, carid, 0);
CreatedCar ++;
format(string, sizeof(string), " Vehicle %d spawned.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
CMD:addcomponent(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] > 3)
{
new componentid;
if(sscanf(params, "i", componentid))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /addcomponent [ComponentID]");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " You are not in a vehicle!");
return 1;
}
new CarId = GetPlayerVehicleID(playerid);
if(componentid < 1000 || componentid > 1193) { SendClientMessage(playerid, COLOR_GREY, " Component ID can't be below 1000 or above 1193 !"); return 1; }
AddVehicleComponent(CarId, componentid);
SendClientMessage(playerid, COLOR_GREEN, " Type /carcomponents for more info!");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, " You are not an Admin.");
return 1;
}
}
return 1;
}
CMD:carcomponents(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] > 3)
{
SendClientMessage(playerid, COLOR_WHITE, " Car Components List");
SendClientMessage(playerid, COLOR_GREEN, " Transfenders spoilers - 1000 - 1003");
SendClientMessage(playerid, COLOR_GREEN, " Roof - 1006");
SendClientMessage(playerid, COLOR_GREEN, " x10 Nos - 1010");
SendClientMessage(playerid, COLOR_GREEN, " Shadow Rims - 1073");
SendClientMessage(playerid, COLOR_GREEN, " Mega Rims - 1074");
SendClientMessage(playerid, COLOR_GREEN, " Rimshine Rims- 1075");
SendClientMessage(playerid, COLOR_GREEN, " Wires Rims - 1076");
SendClientMessage(playerid, COLOR_GREEN, " Classic Rims - 1077");
SendClientMessage(playerid, COLOR_GREEN, " Twist Rims - 1078");
SendClientMessage(playerid, COLOR_GREEN, " Cutter Rims - 1079");
SendClientMessage(playerid, COLOR_GREEN, " Switch Rims - 1080");
SendClientMessage(playerid, COLOR_GREEN, " Grove Rims - 1081");
SendClientMessage(playerid, COLOR_GREEN, " Import Rims - 1082");
SendClientMessage(playerid, COLOR_GREEN, " Dollar Rims - 1083");
SendClientMessage(playerid, COLOR_GREEN, " Trance Rims - 1084");
SendClientMessage(playerid, COLOR_GREEN, " Atomic Rims - 1085");
SendClientMessage(playerid, COLOR_GREEN, " Hydraulics - 1087");
SendClientMessage(playerid, COLOR_GREEN, " Uranus Spoiler - 1063 - 1064");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, " You are not an Admin.");
return 1;
}
}
return 1;
}
Re: /veh - /carcomponent -
Jaua10 - 02.10.2017
Код:
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.
Re: /veh - /carcomponent -
n00blek - 02.10.2017
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
Re: /veh - /carcomponent -
Jaua10 - 02.10.2017
dont work
Re: /veh - /carcomponent -
Zeth - 02.10.2017
Show the lines in which you are getting errors.
Re: /veh - /carcomponent -
Jaua10 - 02.10.2017
Код:
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(playerid, X,Y,Z);
new carid = CreateVehicle(car, X+4,Y,Z, 0.0, color1, color2, 12000);
CreatedCars[CreatedCar] = carid;
PutPlayerInVehicle(playerid, carid, 0);
CreatedCar ++;
format(string, sizeof(string), " Vehicle %d spawned.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
Re: /veh - /carcomponent -
Jaua10 - 02.10.2017
Anyone can help me?