PDA

View Full Version : Help with /find command


qUick1337
28/08/2011, 08:24 PM
I maked some changes on /find command and i add this :
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(PlayerInfo[playerid][pIsAtHouse] == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
}
else if(PlayerInfo[playerid][pIsAtHouse] >= 1)
{
SetPlayerCheckpoint(giveplayerid, HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancex], 6);
}
} if player is in house the checkpoint appear at the entranceX,Y,Z and if player is not in house the player appear normaly. But i have a problem :-? the normal way works but when im in house the checkpoint appear wrong. I need this fast.... :(

qUick1337
29/08/2011, 04:48 AM
up...

AndreT
29/08/2011, 05:34 AM
I assume the house ID the player is in is stored in PlayerInfo[playerid][pIsAtHouse]?

Then you don't need a loop!
if(!PlayerInfo[playerid][pIsAtHouse])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
}
else
{
new h = PlayerInfo[playerid][pIsAtHouse];
SetPlayerCheckpoint(playerid, HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancex], 6);
}

Or, I don't understand what you mean at all :D

Improvement™
29/08/2011, 06:12 AM
Well, or you just can check if player2 is not in the same interior as the player that has executed the /find command.

if(GetPlayerInterior(playerid) == GetPlayerInterior(playerid2))
{
return SendClientMessage(playerid, COLOR_RED, "This player is currently inside a store or apartment.");
}
Change the (playerid2) into the variable in which the second playerid is saved.

qUick1337
29/08/2011, 09:20 AM
I assume the house ID the player is in is stored in PlayerInfo[playerid][pIsAtHouse]?

Then you don't need a loop!
if(!PlayerInfo[playerid][pIsAtHouse])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
}
else
{
new h = PlayerInfo[playerid][pIsAtHouse];
SetPlayerCheckpoint(playerid, HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancex], 6);
}

Or, I don't understand what you mean at all :D

I assume the house ID the player is in is stored in PlayerInfo[playerid][pIsAtHouse] - True... but is not working when im in a house the checkpoint appear in LV Airport :| and the entrace of the house is in LS..

Well, or you just can check if player2 is not in the same interior as the player that has executed the /find command.

if(GetPlayerInterior(playerid) == GetPlayerInterior(playerid2))
{
return SendClientMessage(playerid, COLOR_RED, "This player is currently inside a store or apartment.");
}
Change the (playerid2) into the variable in which the second playerid is saved.

I don't understand that :-s i want to put a checkpoint of the entrance if player is in house, not sendclientmessage...

qUick1337
29/08/2011, 09:38 PM
up... no one can help me ? :(

Jack_Wilson
29/08/2011, 10:10 PM
I don't understand you, why would you even want to find a person in a home, just make it return SendClientMessage(playerid, 0xFFFFFF, "This person is inside a home.");
It's never going to give you a good accurate position if they're inside an interior.

qUick1337
29/08/2011, 10:18 PM
I wanna make it for cops.. when a player have wanted and he enter in house and the cops have /ram command and if the checkpoint appear at house entrance this will be more easy for cops... :p

=WoR=Varth
30/08/2011, 02:13 AM
Do you have ID for your each house?

qUick1337
30/08/2011, 09:28 AM
hmm no, but the id i think can be IsAtHouse or Virtual World

=WoR=Varth
30/08/2011, 09:31 AM
Show me our /exit command.

qUick1337
30/08/2011, 10:22 AM
if ((newkeys==KEY_SECONDARY_ATTACK ))
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
//printf("House :%d",i);
if(IsPlayerInRangeOfPoint(playerid,5.0,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]) && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hVirWorld])
{
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pIsAtHouse] = 0;
PlayerInfo[playerid][pLocal] = 255;
if(HouseInfo[i][hHel] == 1)
{
new Float:tempheal;
GetPlayerHealth(playerid,tempheal);
if(tempheal < 100.0)
{
SetPlayerHealth(playerid,100.0);
}
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
//printf("Bizz :%d",i);
if (PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
SetPlayerPos(playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
PlayerInfo[playerid][pLocal] = 255;
PlayerInfo[playerid][pIsaBank] = 0;
}
}
if(GetPlayerVehicleID(playerid) >= 515 && GetPlayerVehicleID(playerid) <= 527 || GetPlayerVehicleID(playerid) >= 483 && GetPlayerVehicleID(playerid) <= 488 || GetPlayerVehicleID(playerid) >= 202 && GetPlayerVehicleID(playerid) <= 207 || GetPlayerVehicleID(playerid) >= 463 && GetPlayerVehicleID(playerid) <= 482)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
}
else if (PlayerToPoint(3.0, playerid,1308.0020,-55.9934,1002.4965))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2022.7328,1007.6107,10.8203) ;
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pLocal] = 255;
}
else if (PlayerToPoint(3.0, playerid,383.9334,173.6932,1008.3828))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1479.9476,-1770.6115,18.7958);
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pLocal] = 255;
}
else if (PlayerToPoint(6.0, playerid,-1404.5299,-259.0602,1043.6563))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2695.6235,-1704.6960,11.8438);
}
else if (PlayerToPoint(8.0, playerid,-1443.0554,-581.1879,1055.0472))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2111.5686,-443.9720,38.7344);
}
else if (PlayerToPoint(8.0, playerid,-1464.7732,1557.5533,1052.5313))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2080.3079,-406.0309,38.7344);
}
else if (PlayerToPoint(1.3, playerid,371.5647,180.9719,1014.1875))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2060.3362,469.6569,35.1723);
}
else if (PlayerToPoint(8.0, playerid,-2046.9805,-104.6217,35.2027))
{
SetVehiclePos(GetPlayerVehicleID(playerid), -2047.2045,-95.6441,35.1718);
}
else if (PlayerToPoint(8.0, playerid,2549.3835,-1294.5642,1060.9844))
{//Triads Exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2183.9490,647.2375,49.4375);
}
else if (PlayerToPoint(8.0, playerid,1179.2970,-1350.2504,572.7702))
{// Hospital Interior Exit
SetPlayerPos(playerid,-2654.9993,639.0123,14.4531);
PlayerInfo[playerid][pInt] = 0;
SetPlayerInterior(playerid, 0);
}
else if(NoFuel[playerid] == 1)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
NoFuel[playerid] = 0;
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 20)
{//Mafia exit
SetPlayerInterior(playerid,18);
SetPlayerPos(playerid,1292.6249,6.9623,1001.0078);
PlayerInfo[playerid][pInt] = 18;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 5, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 21)
{//Triads exit
SetPlayerInterior(playerid,2);
SetPlayerPos(playerid,2576.4119,-1286.2892,1060.9844);
PlayerInfo[playerid][pInt] = 2;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 5, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 22)
{//Hitman exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1107.5098,-315.6998,74.7422);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 1, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 23)
{//Groove exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2498.8110,-1686.7434,13.4842);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 5, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 24)
{//Ballas exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2145.8455,-1470.4156,25.5467);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 5, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 25)
{//LSV Exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2786.8677,-1926.1432,13.5469);
PlayerInfo[playerid][pInt] = 10;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 5, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 26)
{//VLA Exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,691.0952,-1275.8971,13.5604);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 5, 1);
}
else if (PlayerToPoint(8.0, playerid,-975.975708,1060.983032,1345.671875) && PlayerInfo[playerid][pVirWorld] == 27)
{//Cop exit
SetPlayerInterior(playerid,10);
SetPlayerPos(playerid,240.9944,112.7738,1003.2188) ;
PlayerInfo[playerid][pInt] = 10;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 102;
ResetPlayerWeapons(playerid);
}
else if (PlayerToPoint(8.0, playerid,246.3760,109.2460,1003.2188) && PlayerInfo[playerid][pVirWorld] == 28)
{//NG Armory exit
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-1366.5886,500.4895,11.1953);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVirWorld] = 0;
PlayerInfo[playerid][pLocal] = 255;
}
}

=WoR=Varth
30/08/2011, 10:50 AM
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if(GetPlayerVirtualWorld(playerid) == HouseInfo[i][hVirWorld])
{
SetPlayerCheckpoint(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez],5);
return 1;
}
}