How should I do this?
#1

I want that if youre standing on a pickup and you use shift youll enter.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new keys, updown, leftright;
    GetPlayerKeys(playerid, keys, updown, leftright);
    if(keys == KEY_JUMP)
    {
        for(new i; i<MAX_INTERIORS; i++)
{
        if(pickupid == PickupID[i])
    {
            SetPlayerPos(playerid, InteriorInfo[i][TeleX], InteriorInfo[i][TeleY], InteriorInfo[i][TeleZ]);
            SetPlayerInterior(playerid, InteriorInfo[i][Interior]);
            InInterior[playerid] = i;
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
  }
}
  return 1;
}
It doesnt work and I actually already knew that but I just tried. How should I do this?


Regards.
Reply
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
        if(newkeys & KEY_JUMP)
        {
            for(new i = 0; i < MAX_INTERIORS; i++)
            {
                if(pickupid == PickupID[i])
                {
                    OnPlayerPickUpPickup(playerid, PickupID[i]);
                }
            }
        }
    }
Reply
#3

Quote:
Originally Posted by Donya
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
        if(newkeys & KEY_JUMP)
        {
            for(new i = 0; i < MAX_INTERIORS; i++)
            {
                if(pickupid == PickupID[i])
                {
                    OnPlayerPickUpPickup(playerid, PickupID[i]);
                }
            }
        }
    }
Didnt work since ONPlayerKeyStateChange doesnt know the pickup.
And I dont think it will work by just adding new pickupid;
Reply
#4

Are you using Incognito's streamer?
Reply
#5

sorry, i wasn't in the right mind at that time.

do you want to use incognitos streamer to do this?
Reply
#6

Well, no reply, if you use Incognito's streamer, try this:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_JUMP)
    {
        for(new i = 0; i < MAX_INTERIORS; i++)
        {
            if(IsPlayerIsValidDynamicPickup(PickupID[i]))
            {
                SetPlayerPos(playerid, InteriorInfo[i][TeleX], InteriorInfo[i][TeleY], InteriorInfo[i][TeleZ]);
                SetPlayerInterior(playerid, InteriorInfo[i][Interior]);
                InInterior[playerid] = i;
                SetPlayerVirtualWorld(playerid, 0);
            }
        }
    }
    return 1;
 }
Reply
#7

Tee. Now using your code:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_JUMP)
    {
        for(new i = 0; i < MAX_INTERIORS; i++)
        {
            if(IsValidDynamicPickup(PickupID[i]))
            {
                SetPlayerPos(playerid, InteriorInfo[i][TeleX], InteriorInfo[i][TeleY], InteriorInfo[i][TeleZ]);
                SetPlayerInterior(playerid, InteriorInfo[i][Interior]);
                InInterior[playerid] = i;
                SetPlayerVirtualWorld(playerid, 0);
            }
        }
    }
    return 1;
 }

When I push enter now Im, getting tped without even be on a pickup 0-0
Reply
#8

ANybody?
Reply
#9

pawn Код:
//put getplayerdistancetopoint anywhere above the snippet

stock Float:GetPlayerDistanceToPoint2(playerid, {Float,_}:...)
{
    new num = numargs(), Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    if(num == 3) return floatsqroot(floatpower(floatabs(floatsub(pos[0], Float:getarg(1))), 2) + floatpower(floatabs(floatsub(pos[1], Float:getarg(2))), 2));
    else if(num == 4) return floatsqroot(floatpower(floatabs(floatsub(pos[0], Float:getarg(1))), 2) + floatpower(floatabs(floatsub(pos[1], Float:getarg(2))), 2) + floatpower(floatabs(floatsub(pos[2], Float:getarg(3))), 2));
    return -1.0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_JUMP)
    {
        new Float:Pos[3];
        #define RADIUS 2.0//change this value
        for(new i = 0; i < MAX_INTERIORS; i++)
        {
            if(!IsValidDynamicPickup(PickupID[i])) continue;
            Streamer_GetFloatData(E_STREAMER_TYPE_PICKUP, PickupID[i], E_STREAMER_X, Pos[0]);
            Streamer_GetFloatData(E_STREAMER_TYPE_PICKUP, PickupID[i], E_STREAMER_Y, Pos[1]);
            Streamer_GetFloatData(E_STREAMER_TYPE_PICKUP, PickupID[i], E_STREAMER_Z, Pos[2]);
            if(GetPlayerDistanceToPoint2(playerid, Pos[0], Pos[1], Pos[2]) > RADIUS) continue;
            SetPlayerPos(playerid, InteriorInfo[i][TeleX], InteriorInfo[i][TeleY], InteriorInfo[i][TeleZ]);
            SetPlayerInterior(playerid, InteriorInfo[i][Interior]);
            InInterior[playerid] = i;
            SetPlayerVirtualWorld(playerid, 0);
        }
    }
    return 1;
}
Reply
#10

undefined symbol "E_STREAMER_TYPE_PICKUP"
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)