Whats wrong with this command
#1

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;
        }
    }
Reply
#2

Do you get an error?

If so post it here.
Reply
#3

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]");
Reply
#4

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...
Reply
#5

object 1 doesn't exist i think !
Reply
#6

You should use floatstr where necessary, instead of strval.
Reply
#7

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.
Reply
#8

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)