SA-MP Forums Archive
Whats wrong with this command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with this command (/showthread.php?tid=197157)



Whats wrong with this command - ihatetn931 - 08.12.2010

pawn Код:
if(strcmp(cmd, "/object", true) == 0 || strcmp(cmd, "/obj", true) == 0)
            {
            if (IsPlayerInVehicle(playerid,vehicleid) && PlayerInfo[playerid][pAdmin] == 1 && ObjectId[playerid] == 0)
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
                return 1;
            }
            new id = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
                return 1;
            }
            new rx = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
                return 1;
            }
            new ry = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
                return 1;
            }
            new rz = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
                return 1;
            }
            new Float:x,Float:y,Float:z;
            GetVehiclePos(vehicleid, x, y, z);
            //Fire[playerid] = CreateDynamicObject(id, x, y, z, 0, 0, 0);
            Fire[playerid] = CreateObject(id,x,y,z,rx,ry,rz);
            ObjectId[playerid] = 1;
            format(string, sizeof(string), "Object created with id %d and Coords X:%f | Y:%f | Z:%f | RX:%d | RY:%d | RZ:%d", id,x,y,z,rx,ry,rz);
            SendClientMessage(playerid, COLOR_GREEN, string);
            AttachObjectToVehicle(Fire[playerid],vehicleid,rx,ry,rx,0,0,0);
            return 1;
        }
    }



Re: Whats wrong with this command - Kyle_Olsen - 08.12.2010

Do you get an error?

If so post it here.


Re: Whats wrong with this command - ihatetn931 - 08.12.2010

Quote:
Originally Posted by Kyle_Olsen
Посмотреть сообщение
Do you get an error?

If so post it here.
No, there is no error.

It just keep outputting the
pawn Код:
SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
no matter what i do

/obj 1 1 1
Shows
pawn Код:
SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");



Re: Whats wrong with this command - Kyle_Olsen - 08.12.2010

You keep defining the first variable over and over again, it seems. You have to define them so that it's more variables, not only one.

And it also seems that you are doing strval(tmp); before the tmp is even defined...

Anyway, it's lots of errors in the code, I'd rewrite the whole thing, but I haven't got the time now...


Re: Whats wrong with this command - TheDarkWolf18 - 08.12.2010

object 1 doesn't exist i think !


Re: Whats wrong with this command - [NoV]LaZ - 08.12.2010

You should use floatstr where necessary, instead of strval.


Re: Whats wrong with this command - leong124 - 08.12.2010

What is the usage of this?
Код:
new rz = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
    SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
    return 1;
}
The last strtok reads the 5th parameters(but you only require 4) so that it always shows the error message.
delete
Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
    SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
    return 1;
}
under
Код:
new rz = strval(tmp);
Also,you've posted it to the wrong board.


Re: Whats wrong with this command - Kyle_Olsen - 08.12.2010

Btw, it should be "new Float:rz", not new rz.


Re: Whats wrong with this command - ihatetn931 - 08.12.2010

Quote:
Originally Posted by leong124
Посмотреть сообщение
What is the usage of this?
Код:
new rz = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
    SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
    return 1;
}
The last strtok reads the 5th parameters(but you only require 4) so that it always shows the error message.
delete
Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
    SendClientMessage(playerid, COLOR_SYSTEM, "[[CMDINFO]] /object [objectid] [rx] [ry] [rz]");
    return 1;
}
under
Код:
new rz = strval(tmp);
Also,you've posted it to the wrong board.
It has to do with 3c features. Thank you for the help all