SA-MP Forums Archive
Some wierd stuff but CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Some wierd stuff but CMD (/showthread.php?tid=352436)



Some wierd stuff but CMD [FIXED] - CrazyChoco - 19.06.2012

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]


Re: Some wierd stuff but CMD - jessejanssen - 19.06.2012

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


Re: Some wierd stuff but CMD - CrazyChoco - 19.06.2012

let me try


Re: Some wierd stuff but CMD - CrazyChoco - 19.06.2012

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 :/


Re: Some wierd stuff but CMD - Ray0 - 20.06.2012

Код:
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


Re: Some wierd stuff but CMD - SnG.Scot_MisCuDI - 20.06.2012

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;
}



Re: Some wierd stuff but CMD - Mimic - 20.06.2012

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


Re: Some wierd stuff but CMD - CrazyChoco - 20.06.2012

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


Re: Some wierd stuff but CMD - SnG.Scot_MisCuDI - 20.06.2012

try my code..


Re: Some wierd stuff but CMD - CrazyChoco - 20.06.2012

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