SA-MP Forums Archive
help Required - 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: help Required (/showthread.php?tid=478557)



help Required - newbie scripter - 30.11.2013

Hi Scripters, mappers, etc.

I got a problem.
If u need the code , tell me and also tell me what was the THING which caused this error,...


Re: help Required - ReApZ - 30.11.2013

code plz


Re: help Required - newbie scripter - 30.11.2013

pawn Код:
CMD:sub(playerid, params[])
{
    new Float:Pos[3], sub1, sub2;
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    if(IsInSub[playerid] == false)
    {
        if(IsPlayerInWater(playerid))
        {
            IsInSub[playerid] = true;          
            sub1 = CreateObject(19300, Pos[0] , Pos[1], Pos[2], 0, 0, 0);
            sub2 = CreateObject(1612, 0, 0, 0, 0, 0, 0, 0.0);
            AttachObjectToObject(sub2, sub1 ,0, 0, 0 + 2, 0, 0, 0, 1);
            AttachCameraToObject(playerid, sub2);
            SetPlayerPos(playerid, Pos[0], Pos[0], Pos[2]);
            SetPlayerInterior(playerid, playerid * playerid + playerid + 3 ^ 2);
            ApplyAnimation(playerid, "LOWRIDER", "Sit_relaxed", 4.1, 1, 1, 1, 0, 0, 1);
        }
        else return SendClientMessage(playerid, -1, "Error: You Need To Be In Water To Use This Command");
    }
    return 1;
}
I'm gonna make a drivable submarine FS :P


Re: help Required - newbie scripter - 01.12.2013

Bump...


Re: help Required - newbie scripter - 02.12.2013

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
Bump...
......../././/,


Re: help Required - ReApZ - 02.12.2013

pawno seems fine
update your streamer sccanf and whirlpool


Re: help Required - Threshold - 02.12.2013

Well first of all, when you set a player's interior, their camera is likely to follow. So in this situation, your best option is to probably use TogglePlayerSpectating. I haven't experimented with this, but my guess is that it would work.

pawn Код:
CMD:sub(playerid, params[])
{
    if(IsInSub[playerid] == false)
    {
        if(IsPlayerInWater(playerid))
        {
            new Float:Pos[3], sub1, sub2;
            GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
            IsInSub[playerid] = true;          
            sub1 = CreateObject(19300, Pos[0] , Pos[1], Pos[2], 0, 0, 0);
            sub2 = CreateObject(1612, 0, 0, 0, 0, 0, 0, 0.0);
            AttachObjectToObject(sub2, sub1 ,0, 0, 2, 0, 0, 0, 1);
            TogglePlayerSpectating(playerid, 1);
            AttachCameraToObject(playerid, sub2);
        }
        else return SendClientMessage(playerid, -1, "Error: You Need To Be In Water To Use This Command");
    }
    return 1;
}
This should work, but if it doesn't, let me know the results and I will edit the code accordingly. Also, to let you know, this will indeed affect any kind of 'suboff' commands, or anything similar that are used to get out of the submarine, so if you want to post that command here as well, I can edit it to fit with this command.


Re: help Required - J4mmyHD - 02.12.2013

We'll I found another error,

pawn Код:
SetPlayerPos(playerid, Pos[0], Pos[0], Pos[2]);
To

pawn Код:
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);



Re: help Required - newbie scripter - 03.12.2013

Quote:
Originally Posted by J4mmyHD
Посмотреть сообщение
We'll I found another error,

pawn Код:
SetPlayerPos(playerid, Pos[0], Pos[0], Pos[2]);
To

pawn Код:
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
I did that wanted to check whether my camera is al right :P