SA-MP Forums Archive
how do i get this work? - 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: how do i get this work? (/showthread.php?tid=347214)



how do i get this work? - sampmark05 - 01.06.2012

I've made this CMD so i can get in on a RC car but when i type /rc its not entering the RC Vehicle.

Here's the code

pawn Код:
CMD:rc(playerid, params[])
{
    new closestcar = GetClosestCar(playerid);
    if(IsARC(closestcar) && IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0))
    {
        if(IsPlayerInVehicle(playerid, closestcar))
        {
            new Float:vehPos[3];
            GetVehiclePos(closestcar, vehPos[0], vehPos[1], vehPos[2]);
            SetPlayerPos(playerid, vehPos[0], vehPos[1]+0.5, vehPos[2]+0.5);
        }
        else if(!IsPlayerInAnyVehicle(playerid))
        {
            foreach(Player, i)
            {
                new v = GetPlayerVehicle(i, closestcar);
                if(v != -1 && PlayerVehicleInfo[i][v][pvLocked] == 0)
                {
                    new Float:playerPos[3];
                    GetPlayerPos(playerid, playerPos[0], playerPos[1], playerPos[2]);
                    SetPlayerPos(playerid, playerPos[0], playerPos[1], playerPos[2]-500);
                    PutPlayerInVehicle(playerid, closestcar, 0);
                }
            }
        }
    }
    return 1;
}
This is the stock
pawn Код:
IsARC(carid) // RC Vehicles
{
    new RCs[] = { 441, 464, 465, 501, 564 };
    for(new i = 0; i < sizeof(RCs); i++)
    {
        if(GetVehicleModel(carid) == RCs[i]) return 1;
    }
    return 0;
}



Re: how do i get this work? - Flake. - 01.06.2012

whats the problem, any errors?


Re: how do i get this work? - sampmark05 - 01.06.2012

No errors but when o type /rc its not entering on the RC vehicle


Re: how do i get this work? - MP2 - 01.06.2012

Debug.


Re: how do i get this work? - sampmark05 - 01.06.2012

Debug what?


Re: how do i get this work? - sampmark05 - 01.06.2012

Is this correct?


Re: how do i get this work? - MP2 - 01.06.2012

Quote:
Originally Posted by sampmark05
Посмотреть сообщение
Debug what?
A banana.

Use print(f) and SendClientMessage so you can see a visual representation of how your code is being executed.


Re: how do i get this work? - sampmark05 - 07.06.2012

Ohh Thanks :P u get my1REP