#1

Hi this is my first ZCMD command, also first time using sscanf
here is the command (I just started it)
pawn Код:
CMD:createveh(playerid, params[])
{
    new
        vehid,colorid1,colorid2;
    new
        Float:x,Float:y,Float:z;
    if (sscanf(params, "iii", vehid, colorid1, colorid2)) SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createveh [Vehicle ID] [Color 1 ID] [Color 2 ID]");
    else
    {
        GetPlayerPos(playerid, x, y, z);
        CreateVehicle(vehid, x, y, z, 0, colorid1, colorid2, 1);
    }
    return 1;
}
Код:
(93) : error 029: invalid expression, assumed zero
(93) : error 017: undefined symbol "cmd_createveh"
(93) : error 029: invalid expression, assumed zero
(93) : fatal error 107: too many error messages on one line

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


4 Errors.
idk what's happening,
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Reply
#2

Write it like this
Код:
CMD:createveh(playerid, params[])
{
    new
        vehid,colorid1,colorid2,Float:p[3];
    if (sscanf(params, "iii", vehid, colourid1, colourid2))return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createveh [Vehicle ID] [Coulour 1 ID] [Colour 2 ID]");
    
        GetPlayerPos(playerid, p[0],p[1],p[2]);
        new v = CreateVehicle(vehid, p[0],p[1],p[2], 0, color1, color2, 1);
PutPlayerInVehicle(playerid,v,1);// Puts player in the Vehicle
        return 1;
   
}
You had if (sscanf(params, "iii", vehid, colourid1, colourid2,x,y,z.
That's wrong cause' you have "iii". and because of that you need 3 params. vehid = 1, c1 = 2 & c2 = 3. x,y,z are 3 to much
Reply
#3

that's just a better way to make the command, it doesn't fix the errors :/
Reply
#4

It should. You tested it?
Reply
#5

yes I did, as you see there's an error saying " undefined symbol "cmd_createveh" which means that there's a problem with ZCMD maybe?
Reply
#6

Oh yeah. I think you'll have to use "COMMAND:Createveh" instead of "CMD:createveh". I'm not sure
Reply
#7

same thing :P weird
Reply
#8

Is the Command in "OnPlayerCommandText" ?
Reply
#9

Quote:
Originally Posted by Sarra
Посмотреть сообщение
Hi this is my first ZCMD command, also first time using sscanf
here is the command (I just started it)
pawn Код:
CMD:createveh(playerid, params[])
{
    new
        vehid,colorid1,colorid2;
    new
        Float:x,y,z;
    if (sscanf(params, "iii", vehid, colorid1, colorid2, x, y, z,)) SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createveh [Vehicle ID] [Color 1 ID] [Color 2 ID]");
    else
    {
        GetPlayerPos(playerid, x, y, z);
        CreateVehicle(vehid, x, y, z, 0, color1, color2, 1);
        return 1;
    }
}
Код:
(93) : error 029: invalid expression, assumed zero
(93) : error 017: undefined symbol "cmd_createveh"
(93) : error 029: invalid expression, assumed zero
(93) : fatal error 107: too many error messages on one line

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


4 Errors.
idk what's happening,
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
here you go
PHP код:
CMD:createveh(playeridparams[])
{
    new 
vehid,colorid1,colorid2;
    new 
Float:x,Float:y,Float:z;
    if(
sscanf(params"iii"vehidcolorid1colorid2))
    {
        
SendClientMessage(playerid0xFFFFFFFF"Usage: /createveh [Vehicle ID] [Color 1 ID] [Color 2 ID]");
    }
    else
    {
        
GetPlayerPos(playeridxyz);
        
CreateVehicle(vehidxyz0colorid1colorid21);
    }
    return 
1;

or you can make it to look like this
PHP код:
CMD:createveh(playeridparams[])
{
    new 
vehid,colorid1,colorid2;
    new 
Float:x,Float:y,Float:z;
    if(
sscanf(params"iii"vehidcolorid1colorid2)) SendClientMessage(playerid0xFFFFFFFF"Usage: /createveh [Vehicle ID] [Color 1 ID] [Color 2 ID]");
    
GetPlayerPos(playeridxyz);
    
CreateVehicle(vehidxyz0colorid1colorid21);
    return 
1;

same but looks different xD
Reply
#10

Quote:
Originally Posted by yellow
Посмотреть сообщение
Is the Command in "OnPlayerCommandTecxt" ?
edit
2 late
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)