A warning.
#1

The warning i get is
Number of arguments doesnt match definations.

and the code along with the warning line is
pawn Код:
if(GarageInfo[idx][gLevel] == 1 && !IsPlayerInAnyVehicle(playerid))
            {
               SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               SetPlayerInterior(playerid, 1);
               SetPlayerVirtualWorld(playerid, idx+500);
               return 1;
            }
            else if(IsPlayerInVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // warning line
            {
               SetVehiclePos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
               SetVehicleVirtualWorld(playerid, idx+500);
               return 1;
            }
Reply
#2

pawn Код:
IsPlayerInVehicle(playerid)
IsPlayerInVehicle has 2 parameters: playerid, vehicleid

Unless you wanted to call IsPlayerInAnyVehicle which has only 1 parameter (playerid) and you mistyped it.
Reply
#3

Thanks man
Reply
#4

Function 'IsPlayerInVehicle' should be like this: IsPlayerInVehicle(playerid, VEHID)
https://sampwiki.blast.hk/wiki/Function:IsPlayerInVehicle
EDIT: Fuuuu. Konstantinos always wins
Reply
#5

Alright thats fixed but i havent still fixed a problem related to garage, either i am on foot or in a car i cant enter my garage it just does nothing thats my entergarage command
pawn Код:
CMD:entergarage(playerid, params[])
{
        new idx, string[128];
        if(IsPlayerInRangeOfPoint(playerid, 2, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
        {
            if(!GarageInfo[idx][gStatus] && PlayerInfo[playerid][pGarage] != idx && PlayerInfo[playerid][pVGarage] != idx) return SendClientMessage(playerid, COLOR_GREY, "This garage is locked by its owner.");
            format(string, sizeof(string), "** %s pushes the shutter and enters the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            new carid = GetPlayerVehicleID(playerid);
            if(GarageInfo[idx][gLevel] == 1 && !IsPlayerInAnyVehicle(playerid))
            {
               SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               SetPlayerInterior(playerid, 1);
               SetPlayerVirtualWorld(playerid, idx+500);
               return 1;
            }
            else if(IsPlayerInVehicle(playerid, carid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
               SetVehiclePos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
               SetVehicleVirtualWorld(playerid, idx+500);
               return 1;
            }

        }
        return 1;
}
Reply
#6

You declare "idx" so it's by default 0. Then you check if the player is in range of the first garage (that you probably are not). Loop through garages and check if the player is in range of any of those garages and do your code.

And by the way checking if the player is inside the current vehicle he is, it's a bit pointless. Just use the check about the state (if it's PLAYER_STATE_DRIVER).
Reply
#7

Lool i am sure i will do it buggy again if i edit it myself dude can you edit the code above? Thanks
Reply
#8

Do a copy of it and give it a try. I am not aware of your system so it's better if you do that.
Reply
#9

Man honestly i am a newbie scripter and got no idea how i do it, see how i tried which still didnt work.
pawn Код:
CMD:entergarage(playerid, params[])
{
        new garageid, idx, string[128];
        if(IsPlayerInRangeOfPoint(playerid, 2, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
        {
            if(!GarageInfo[garageid][gStatus] && PlayerInfo[playerid][pGarage] != garageid && PlayerInfo[playerid][pVGarage] != garageid) return SendClientMessage(playerid, COLOR_GREY, "This garage is locked by its owner.");
            format(string, sizeof(string), "** %s pushes the shutter and enters the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            new carid = GetPlayerVehicleID(playerid);
            if(GarageInfo[garageid][gLevel] == 1 && !IsPlayerInAnyVehicle(playerid))
            {
               SetPlayerPos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               SetPlayerInterior(playerid, 1);
               SetPlayerVirtualWorld(playerid, idx+500);
               return 1;
            }
            else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
               SetVehiclePos(playerid, -72.5507,-20.3314,972.5516);
               SetPlayerFacingAngle(playerid, 267.0980);
               SetCameraBehindPlayer(playerid);
               LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
               SetVehicleVirtualWorld(playerid, idx+500);
               return 1;
            }

        }
        return 1;
}
Reply
#10

oh c'mon
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)