Some wierd stuff but CMD
#1

Hai, im trying to make an code into zcmd but when i do ill get this ingame even if i fill it corret out here is my code:
pawn Код:
CMD:addhouse(playerid, params, cmdtext[])//Admin CMD //bug
{
        new string[256];
    new cmd[256];
    new giveplayerid, idx;
    new tmp[256];


    cmd = strtok(cmdtext, idx);
new Float:x, Float:y, Float:z, Float:r, price, interior, id, msg[128];
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, r);
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)){
        ERROR("Usage: /AddHouse [price] (interior=0)");
        return 1;
        }

        price = strval(tmp);
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)){
        ERROR("Usage: /AddHouse [price] (interior=0)");
        return 1;
        }


        interior = strval(tmp);




        if ((id = CreateHouse(x, y, z, r, price, interior)) == INVALID_HOUSE_ID) ERROR("House could not be created! House limit "#MAX_HOUSES" may have been reached");
        format(MSG, "House %d has been created with price %s and interior %d", id, FormatMoney(Houses[id][house_price]), Houses[id][house_interior]);
        MESSAGE(msg);
        Streamer_Update(playerid);
        return 1;
}
CMD:telehouse(playerid, params, cmdtext[])//some kind of bug
{
        new string[256];
    new cmd[256];
    new giveplayerid, idx;
    new tmp[256];


    cmd = strtok(cmdtext, idx);
        new Float:x, Float:y, Float:z, id;
        tmp = strtok(cmdtext,idx);

        if(!strlen(tmp)) return ERROR("Usage: /Telehouse [houseid]");

        id = strval(tmp);

        if (!GetHousePos(id, x, y, z)) return ERROR("Invalid house id!");
        SetPlayerPos(playerid, x, y ,z);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, x, y, z);
        return 1;
}
when i type ex. telehouse 5 ill recive this
Usage: /Telehouse [houseid]
Reply
#2

You shouldn't use 'cmdtext[]' in ZCMD, do instead of:
pawn Код:
CMD:telehouse(playerid, params, cmdtext[])
This:
pawn Код:
CMD:telehouse(playerid, params)
Then you just do:
pawn Код:
cmd = strtok(params, idx);
As example.

Best regards,
Jesse
Reply
#3

let me try
Reply
#4

C:\Users\Kajinth Thaas\Desktop\samp03e\gamemodes\cgcnr.pwn(24396) : error 017: undefined symbol "cmdtext"
C:\Users\Kajinth Thaas\Desktop\samp03e\gamemodes\cgcnr.pwn(2439 : error 017: undefined symbol "cmdtext"
C:\Users\Kajinth Thaas\Desktop\samp03e\gamemodes\cgcnr.pwn(24392) : warning 203: symbol is never used: "idx"

my code/cmd

pawn Код:
CMD:telehouse(playerid, params)//some kind of bug
{
        new string[256];
    new cmd[256];
    new giveplayerid, idx;
    new tmp[256];


    cmd = strtok(cmdtext, idx);
        new Float:x, Float:y, Float:z, id;
        tmp = strtok(cmdtext,idx);

        if(!strlen(tmp)) return ERROR("Usage: /Telehouse [houseid]");

        id = strval(tmp);

        if (!GetHousePos(id, x, y, z)) return ERROR("Invalid house id!");
        SetPlayerPos(playerid, x, y ,z);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, x, y, z);
        return 1;
}
even if i use [] or not :/
Reply
#5

Код:
C:\Users\Kajinth Thaas\Desktop\samp03e\gamemodes\cgcnr.pwn(24396) : error 017: undefined symbol "cmdtext"
You don't need "cmdtext", as it is replaced by "params" in ZCMD. So replace cmdtext with params
Reply
#6

pawn Код:
CMD:telehouse(playerid, params[])
{
    new string[256],
        cmd[256],
        giveplayerid,
        idx,
        tmp[256];

    new Float:House[3], id;
        cmd = strtok(params, idx);
        tmp = strtok(params,idx);

    if(!strlen(tmp)) return ERROR("Usage: /Telehouse [houseid]");

    id = strval(tmp);

    if (!GetHousePos(id, House[0], House[1], House[2])) return ERROR("Invalid house id!");
    SetPlayerPos(playerid,House[0], House[1], House[2]);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, House[0], House[1], House[2]);
    return 1;
}
Reply
#7

pawn Код:
COMMAND:whatever(playerid, params[])
Don't ever forget the [] otherwise it will not work.
Reply
#8

i got the same error with it or not, please help
Reply
#9

try my code..
Reply
#10

Getting no errors, but it still wont work with your code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)