PICKUP ERROR
#1

Hi everyone

I Have a problem with my house pickups then i enter the house pickup he set my to interior
but then I want to exit I exit the building and I again appear on pickup and he set my again to interior.
What can by wrong what I must do?
Please help I need this.
Reply
#2

Give us the pickup code ... which should be in OnPlayerPickUpPickup callback.
Reply
#3

Quote:
Originally Posted by Serifukas
Посмотреть сообщение
Hi everyone

I Have a problem with my house pickups then i enter the house pickup he set my to interior
but then I want to exit I exit the building and I again appear on pickup and he set my again to interior.
What can by wrong what I must do?
Please help I need this.

[vid]http://s1191.photobucket.com/albums/z466/serifukas/?action=view&current=Video.mp4[/vid]
There is a couple solutions to your problem.

First: You could offset the players coordinates on exit interior.

Second: Create a variable lastenter[playerid] = blah
onplayerpickup if lastenter[playerid] = pickupid return 1;

Third: Set the marker type to disappear after pickup for short time.

Feel free to ask about any of those solutions.
Reply
#4

This is my house exit command :

Код:
        if(!strcmp(cmdtext, "/exit", true))
		{
		    new house = GetPlayerVirtualWorld(playerid);
		    SetPlayerInterior(playerid,0);
		    SetPlayerVirtualWorld(playerid,0);
		    SetPlayerPos(playerid,PickupIDs[house][0],PickupIDs[house][1],PickupIDs[house][2]);
  		    playerDB[playerid][pickup]=false;
		    SetTimerEx("WantPickup",7000,0,"i",playerid); //exiting
			return 1;
		}
This is pickup code :

FIX_PICKUPS

Код:
 	if(pickupid > pickups[0][namai]-1 && pickupid < pickups[1][namai]+1) //HOUSES
	{
	    new name[MAX_PLAYER_NAME];
		GetPlayerName(playerid,name,sizeof(name));

		if(!strcmp(name,houseDB[pickupid][owner_name],true)) //If player house owner
		{
			SendClientMessage(playerid,COLOR,"* {00FFEE}This is your home! {FFFFFF}House commands:");
			SendClientMessage(playerid,COLOR,"* {6EF83C}/heal /selhouse ");
			SendClientMessage(playerid,COLOR,"* {FF00EA}/exit");
			new inter = houseDB[pickupid][setting];
			SetPlayerInterior(playerid,houseSETTINGS[inter][interior]);
			SetPlayerPos(playerid,houseSETTINGS[inter][enter_pos][0],houseSETTINGS[inter][enter_pos][1],houseSETTINGS[inter][enter_pos][2]);
			SetPlayerVirtualWorld(playerid,pickupid);
			return 1;
		}
My created pickups codes looks like this :

Код:
pickups[0][namai]=CreatePickupA(1273 ,2, -2789.889404, -181.189849, 9.991617); 
CreatePickupA(1273 ,2, -2791.019531, -82.611297, 7.195312); 
CreatePickupA(1273 ,2, -1810.5671,1325.5807,8.1552); 
CreatePickupA(1273 ,2, -2482.7854,121.7706,32.1258);
pickups[1][namai]=CreatePickupA(1273 ,2, -2216.985351, 577.820617, 35.171875);
Reply
#5

A possible solution would be to use GetXYBehindPlayer and store that location when they enter then teleport them there when they exit.

Another solution is to subtract like -5 from the exit coordinate like so. But that may lead to putting them in wall xD
SetPlayerPos(playerid,houseSETTINGS[inter][enter_pos][0]-5,houseSETTINGS[inter][enter_pos][1]-5,houseSETTINGS[inter][enter_pos][2]);

Another solution is to make them type /enter similar to grand larceny or press enter when they are on the pickup.


Код:
Float:GetXYBehindPlayer(playerid, &Float:q, &Float:w, Float:distance)

{

new Float:a;

GetPlayerPos(playerid, q, w, a);

if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);

else GetPlayerFacingAngle(playerid, a);

q += (distance * -floatsin(-a, degrees));

w += (distance * -floatcos(-a, degrees));

return a;

}
Reply
#6

THANKS I FIXED IT
Reply
#7

The best sollution for it is OnPlayerKeyStateChange. Just place your code to enter building into OnPlayerKeyState change after some key pressed. For example:

pawn Код:
if(newkeys & KEY_SPRINT)
{
// Your code to enter an interior.
}
But if you wan't to make it other way tell me. I will try to help you just think for a better sollution

edit://
When you're editing your post type edit:// and then tell us you fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)