Setting OBject Rotation
#1

Hey, i'm blackout
Here's what i want to happen, when they enter a NUMBER in the Dialog, it will rotate the sam object to the rotation they entered ( only side rotation, not x )
My Code

pawn Код:
if(listitem == 2) // SAm movement
            {
                ShowPlayerDialog(playerid,SAMMOVE,DIALOG_STYLE_INPUT,"Weapon Targetting Control ( Rotation )", "Enter the Rotation you want", "Move", "Cancel");
            }
pawn Код:
if(dialogid == SAMMOVE)
    {
        if(response)
        {
            if(listitem == 0)
            {
                SetObjectRot( sam, 0.000, 0.000, 0.000 );
            }
        }
    }
Reply
#2

Use strval(inputtext).

Ex:

pawn Код:
SetObjectRot( sam, 0.000, strval(inputtext), 0.000 );
Reply
#3

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Use strval(inputtext).

Ex:

pawn Код:
SetObjectRot( sam, 0.000, strval(inputtext), 0.000 );
Very helpful, thank you very much
Reply
#4

Here's my CURRENT code
pawn Код:
if(dialogid == SAMMOVE)
    {
        if(response)
        {
            if(listitem == 0)
            {
                new amount;
                amount = strval(inputtext);
                SetObjectRot(sam, amount, 0.00000000, 0.00000000 );
            }
        }
    }
The Problem is, when i type in the NUMBER in the Input, it DOES NOT move at all -.-
Reply
#5

You need to use sscanf to split the three values up, or ask them to enter X then Y then Z on three separate dialogs.

pawn Код:
if(dialogid == SAMMOVE && response)
{
    new Float:x, Float:y, Float:z;
    if(sscanf(inputtext, "fff", x, y, z))
    {
        // Error with input - check for commas instead
        if(sscanf(inputtext, "p<,>fff", x, y, z))
        {
            // Coordinates failed - re-show dialog with a message or something
        }
    }
    SetObjectRot(sam, x, y, z);
}
With that they will have to enter something like '133.7 69.0 123.45' in the dialog, or with commas.
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
You need to use sscanf to split the three values up, or ask them to enter X then Y then Z on three separate dialogs.

pawn Код:
if(dialogid == SAMMOVE && response)
{
    new Float:x, Float:y, Float:z;
    if(sscanf(inputtext, "fff", x, y, z))
    {
        // Error with input - check for commas instead
        if(sscanf(inputtext, "p<,>fff", x, y, z))
        {
            // Coordinates failed - re-show dialog with a message or something
        }
    }
    SetObjectRot(sam, x, y, z);
}
With that they will have to enter something like '133.7 69.0 123.45' in the dialog, or with commas.
I say Fuck this idea XD I'll just do something else and also as i've said on my other thread https://sampforum.blast.hk/showthread.php?tid=346049

where in nobody answered until now,

How can i make the Z like 10 - 1000? Because if its one number only, and if that person is in a plane / helicopter then the Defence System won't be so accurate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)