12.03.2014, 18:56
First:
It's always saying: "This vehicle doesn't have trunk!"
And second problem:
It's always saying: "There isn't any suspect near you to cuff."
Codes you might need to fix those problems:
Thanks for help in advance
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;
}
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;
}
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;
}