HELP[Problem]
#1

a frined gave me a cool thing..and doesent work well im supposed to see car interior but sometimes when i go in car i dont see car interior please help!

PHP код:
                if(newstate == PLAYER_STATE_DRIVER)
                {
                if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Trebuie sa fiti la volan.");
                {
                if(
GetPVarInt(playerid,"used") == 0)
                {
                new 
car GetPlayerVehicleID(playerid);
                
obj[playerid] = CreatePlayerObject(playerid,193000.0000, -1282.998410.14930.0000, -1, -1100);
                
AttachPlayerObjectToVehicle(playerid,obj[playerid],car,-0.314999, -0.1950000.5100000.0000000.0000000.000000);
                
AttachCameraToPlayerObject(playerid,obj[playerid]);
                
SetPVarInt(playerid,"used",1);
                }
                else if(
GetPVarInt(playerid,"used") == 1)
                {
                
SetCameraBehindPlayer(playerid);
                
DestroyPlayerObject(playerid,obj[playerid]);
                
SetPVarInt(playerid,"used",0);
                }
                } 
Reply
#2

There were lot of loose braces in your code and even loose indentation.

Try this one:
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
                {
                        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Trebuie sa fiti la volan.");
                        if(GetPVarInt(playerid,"used") == 0)
                        {
                            new car = GetPlayerVehicleID(playerid);
                            obj[playerid] = CreatePlayerObject(playerid,19300, 0.0000, -1282.9984, 10.1493, 0.0000, -1, -1, 100);
                            AttachPlayerObjectToVehicle(playerid,obj[playerid],car,-0.314999, -0.195000, 0.510000, 0.000000, 0.000000, 0.000000);
                            AttachCameraToPlayerObject(playerid,obj[playerid]);
                            SetPVarInt(playerid,"used",1);
                        }
                        else if(GetPVarInt(playerid,"used") == 1)
                        {
                          SetCameraBehindPlayer(playerid);
                          DestroyPlayerObject(playerid,obj[playerid]);
                          SetPVarInt(playerid,"used",0);
                        }
                        return 1;
                }
Reply
#3

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
There were lot of loose braces in your code and even loose indentation.

Try this one:
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
                {
                        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Trebuie sa fiti la volan.");
                        if(GetPVarInt(playerid,"used") == 0)
                        {
                            new car = GetPlayerVehicleID(playerid);
                            obj[playerid] = CreatePlayerObject(playerid,19300, 0.0000, -1282.9984, 10.1493, 0.0000, -1, -1, 100);
                            AttachPlayerObjectToVehicle(playerid,obj[playerid],car,-0.314999, -0.195000, 0.510000, 0.000000, 0.000000, 0.000000);
                            AttachCameraToPlayerObject(playerid,obj[playerid]);
                            SetPVarInt(playerid,"used",1);
                        }
                        else if(GetPVarInt(playerid,"used") == 1)
                        {
                          SetCameraBehindPlayer(playerid);
                          DestroyPlayerObject(playerid,obj[playerid]);
                          SetPVarInt(playerid,"used",0);
                        }
                        return 1;
                }

pawno stops responding need to take out return 1; and its all same..i put it at OnPlayerStateChange
EDIT:need brackets doesent work how you did it sorry
Reply
#4

anyone knows from this full forum?
Reply
#5

bumb sorry
Reply
#6

Debug to find out the problem.
Debugging Guide
Reply
#7

Try this
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Trebuie sa fiti la volan.");

    if(!GetPVarInt(playerid,"used"))
    {
        new car = GetPlayerVehicleID(playerid);
        obj[playerid] = CreatePlayerObject(playerid,19300, 0.0000, -1282.9984, 10.1493, 0.0000, -1, -1, 100);
        AttachPlayerObjectToVehicle(playerid,obj[playerid],car,-0.314999, -0.195000, 0.510000, 0.000000, 0.000000, 0.000000);
        AttachCameraToPlayerObject(playerid,obj[playerid]);
        SetPVarInt(playerid,"used",1);
    }
    else
    {
        SetCameraBehindPlayer(playerid);
        DestroyPlayerObject(playerid,obj[playerid]);
        SetPVarInt(playerid,"used",0);
    }
}
Reply
#8

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Try this
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Trebuie sa fiti la volan.");

    if(!GetPVarInt(playerid,"used"))
    {
        new car = GetPlayerVehicleID(playerid);
        obj[playerid] = CreatePlayerObject(playerid,19300, 0.0000, -1282.9984, 10.1493, 0.0000, -1, -1, 100);
        AttachPlayerObjectToVehicle(playerid,obj[playerid],car,-0.314999, -0.195000, 0.510000, 0.000000, 0.000000, 0.000000);
        AttachCameraToPlayerObject(playerid,obj[playerid]);
        SetPVarInt(playerid,"used",1);
    }
    else
    {
        SetCameraBehindPlayer(playerid);
        DestroyPlayerObject(playerid,obj[playerid]);
        SetPVarInt(playerid,"used",0);
    }
}
i tried it and pawno keeps stop responding..
Reply
#9

how do i debug the code thingy??
Reply
#10

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Try this
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
                {
                    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Trebuie sa fiti la volan.");
                    printf("DEBUG: Volan");
                    if(!GetPVarInt(playerid,"used"))
                    {
                        new car = GetPlayerVehicleID(playerid);
                        obj[playerid] = CreatePlayerObject(playerid,19300, 0.0000, -1282.9984, 10.1493, 0.0000, -1, -1, 100);
                        AttachPlayerObjectToVehicle(playerid,obj[playerid],car,-0.314999, -0.195000, 0.510000, 0.000000, 0.000000, 0.000000);
                        AttachCameraToPlayerObject(playerid,obj[playerid]);
                        SetPVarInt(playerid,"used",1);
                    }
                    else
                    {
                        SetCameraBehindPlayer(playerid);
                        DestroyPlayerObject(playerid,obj[playerid]);
                        SetPVarInt(playerid,"used",0);
                    }
                }
like this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)