Two problems
#1

First:

pawn Код:
if(!strcmp(cmdtext, "/trunk", true) || !strcmp(cmdtext, "/tr", true))
    {
        for(new vid; vid<MAX_VEHICLES; vid++)
        {
            new Float: vx, Float:vy, Float:vz;
            GetVehiclePos(vid,vx,vy,vz);
            GetXYBehindCar(vid, vx, vy, 3.5);
            if(IsModelAPlane(vid) || IsModelABike(vid) || IsModelAHeli(vid) || IsModelABoat(vid) || IsModelASpecial(vid))
            {
                SendClientMessage(playerid, -1, "{FF6A22}INFO: {FFFFFF}This vehicle doesn't have trunk!");
                return 1;
            }
            if(IsPlayerInRangeOfPoint(playerid,1.5,vx,vy,vz))
            {
                ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Choose an option", "{5555FF}Open/Close the trunk \n{5555FF}Put in trunk \n{5555FF}Take from trunk", "Select", "Close");
            }
        }
        return 1;
    }
It's always saying: "This vehicle doesn't have trunk!"

And second problem:

pawn Код:
if(!strcmp(cmdtext, "/cuff", true))
        {
            if(sendername[0] == '[' && sendername[1] == 'P' && sendername[2] == 'D' && sendername[3] == ']' || GetPlayerSkin(playerid) == 71)
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(i!=playerid)
                    {
                        if(IsPlayerBehindPlayer(playerid,i,0.5,0.5))
                        {
                            SendClientMessage(playerid,COLOR_RED,"You cuffed a suspect.");
                            SetPlayerSpecialAction(i,SPECIAL_ACTION_CUFFED);
                            SetPlayerAttachedObject(i,6,19418,6,-0.000999,0.038999,-0.016000,162.300003,-169.399963,-76.699989,0.855000,1.412998,1.711999);
                            GameTextForPlayer(i,"~r~BUSTED!!",3000,5);
                        }
                        else
                        {
                            SendClientMessage(playerid,COLOR_RED,"There isn't any suspect near you to cuff.");
                            return 1;
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"You are not authorized to use this command.");
                return 1;
            }
            return 1;
        }
It's always saying: "There isn't any suspect near you to cuff."

Codes you might need to fix those problems:

pawn Код:
stock IsPlayerBehindPlayer(playerid,targetid,Float:distance,Float:range)
{
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid))return 0;
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(targetid, x, y, z);//my pos
        GetXYInBehindPlayer(targetid,x,y,distance);
        if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))return 1;
    }
    return 0;
}
pawn Код:
stock GetXYInBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    a -= 180.0;
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
pawn Код:
forward IsModelAPlane(carid);
public IsModelAPlane(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 460 || modelid == 464 || modelid == 476 || modelid == 511 || modelid == 512 || modelid == 513 || modelid == 519 || modelid == 520 || modelid == 553 || modelid == 577 || modelid == 592 || modelid == 593)
    {
        return 1;
    }
    return 0;
}

forward IsModelABike(carid);
public IsModelABike(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 448 || modelid == 461 || modelid == 462 || modelid == 463 || modelid == 468 || modelid == 471 || modelid == 481 || modelid == 509 || modelid == 510 || modelid == 521 || modelid == 522 || modelid == 523 || modelid == 581 || modelid == 586)
    {
        return 1;
    }
    return 0;
}

forward IsModelABycicle(carid);
public IsModelABycicle(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 509 || modelid == 481 || modelid == 510)
    {
        return 1;
    }
    return 0;
}

forward IsModelAHeli(carid);
public IsModelAHeli(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 417 || modelid == 425 || modelid == 447 || modelid == 465 || modelid == 469 || modelid == 487 || modelid == 488 || modelid == 497 || modelid == 501 || modelid == 548 || modelid == 563)
    {
        return 1;
    }
    return 0;
}

forward IsModelABoat(carid);
public IsModelABoat(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 430 || modelid == 446 || modelid == 452 || modelid == 453 || modelid == 454 || modelid == 472 || modelid == 473 || modelid == 484 || modelid == 493)
    {
        return 1;
    }
    return 0;
}

forward IsModelASpecial(carid);
public IsModelASpecial(carid)
{
    new m = GetVehicleModel(carid);
    if(m == 424 || m == 432 || m == 449 || m == 457 || m == 485 || m == 486 || m == 500 || m == 532 || m == 537 || m == 568 || m == 571 || m == 572 || m == 573 || m == 574 || m == 429 || m == 480 || m == 533 || m == 536 || m == 467 || m == 575)
    {
        return 1;
    }
    return 0;
}
Thanks for help in advance
Reply
#2

First one depends on the definitions of
pawn Код:
IsModelAPlane(vid)
IsModelABike(vid)
IsModelAHeli(vid)
IsModelABoat(vid)
IsModelASpecial(vid)
Reply
#3

What is wrong here then.. ?

pawn Код:
forward IsModelAPlane(carid);
public IsModelAPlane(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 460 || modelid == 464 || modelid == 476 || modelid == 511 || modelid == 512 || modelid == 513 || modelid == 519 || modelid == 520 || modelid == 553 || modelid == 577 || modelid == 592 || modelid == 593)
    {
        return 1;
    }
    return 0;
}

forward IsModelABike(carid);
public IsModelABike(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 448 || modelid == 461 || modelid == 462 || modelid == 463 || modelid == 468 || modelid == 471 || modelid == 481 || modelid == 509 || modelid == 510 || modelid == 521 || modelid == 522 || modelid == 523 || modelid == 581 || modelid == 586)
    {
        return 1;
    }
    return 0;
}

forward IsModelABycicle(carid);
public IsModelABycicle(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 509 || modelid == 481 || modelid == 510)
    {
        return 1;
    }
    return 0;
}

forward IsModelAHeli(carid);
public IsModelAHeli(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 417 || modelid == 425 || modelid == 447 || modelid == 465 || modelid == 469 || modelid == 487 || modelid == 488 || modelid == 497 || modelid == 501 || modelid == 548 || modelid == 563)
    {
        return 1;
    }
    return 0;
}

forward IsModelABoat(carid);
public IsModelABoat(carid)
{
    new modelid = GetVehicleModel(carid);
    if(modelid == 430 || modelid == 446 || modelid == 452 || modelid == 453 || modelid == 454 || modelid == 472 || modelid == 473 || modelid == 484 || modelid == 493)
    {
        return 1;
    }
    return 0;
}

forward IsModelASpecial(carid);
public IsModelASpecial(carid)
{
    new m = GetVehicleModel(carid);
    if(m == 424 || m == 432 || m == 449 || m == 457 || m == 485 || m == 486 || m == 500 || m == 532 || m == 537 || m == 568 || m == 571 || m == 572 || m == 573 || m == 574 || m == 429 || m == 480 || m == 533 || m == 536 || m == 467 || m == 575)
    {
        return 1;
    }
    return 0;
}
Reply
#4

These functions are correct i think but... you have on your server maximum vehicles? It isn't problem at all but if the first created vehicle is boat/bike/heli/etc then you have problem
Reply
#5

Are you using

Код:
GetXYInBehindPlayer
in other commands? are you sure this really works?
Reply
#6

@Matess: I'm using already scripted gamemode grandlarc(from samp team I think so) - for testing my scripts that's all I can say

@Radyx: Yes I'm using this at /cuff and /uncuff, and as I see it's not working
Reply
#7

from grandlarc

pawn Код:
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt"); //this loads at400 and you are blocking it in your script so return 1 will be called and you are done..
Reply
#8

Quote:
Originally Posted by Matess
Посмотреть сообщение
from grandlarc

pawn Код:
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt"); //this loads at400 and you are blocking it in your script so return 1 will be called and you are done..
So what I need to add/change?
Reply
#9

I don't think the vehicles are the problem, can i see the code from: GetXYBehindCar( );
Reply
#10

pawn Код:
forward Float:GetXYBehindCar(vid, &Float:q, &Float:w, Float:distance);
Float:GetXYBehindCar(vid, &Float:q, &Float:w, Float:distance)
{
    new Float:a;
    GetVehiclePos(vid, q, w, a);
    GetVehicleZAngle(vid, a);
    q += (distance * -floatsin(-a, degrees));
    w += (distance * -floatcos(-a, degrees));
    return a;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)