PVars the problem?
#1

pawn Код:
new bag[MAX_PLAYERS];
pawn Код:
if(strcmp(cmdtext, "/moneybag", true) == 0 || strcmp(cmdtext, "/mb", true) == 0)
    {
        if(GetPVarInt(playerid,"hadbag")==1)
        {
            DestroyObject(bag[playerid]);
            DeletePVar(playerid,"hadbag");
            SendClientMessage(playerid,red,"You no longer have a bag on you");
            return 1;
        } else if(GetPVarInt(playerid,"bag")==0) {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            bag[playerid] = AttachObjectToPlayer(1550,playerid,X,Y,Z,0,0,0);
            SendClientMessage(playerid,green,"You now have a bag on you");
        }
        return 1;
    }
No errors no warnings, just wont show the object ingame attached to the player


EDIT: I don't know PVars so don't flame me cuz of it
Reply
#2

Snarl@@ help
Reply
#3

I think AttachObjectToPlayer was removed in 0.3.
Reply
#4

pawn Код:
if(!strcmp(cmdtext, "/moneybag", true, 9) || !strcmp(cmdtext, "/mb", true, 3))
{
    if(GetPVarInt(playerid,"bag"))
    {
        DestroyObject(GetPVarInt(playerid, "bag"));
        DeletePVar(playerid,"bag");
        SendClientMessage(playerid,red,"You no longer have a bag on you");
        return 1;
    }
    else
    {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,X,Y,Z);
        SetPVarInt(playerid, "bag", CreateObject(1550, X, Y, Z, 0, 0, 0));
        AttachObjectToPlayer(GetPVarInt(playerid, "bag"), playerid, X, Y, Z, 0, 0, 0);
        SendClientMessage(playerid,green,"You now have a bag on you");
    }
    return 1;
}
Reply
#5

didnt help
Reply
#6

Quote:
Originally Posted by EllipseRage
Посмотреть сообщение
I think AttachObjectToPlayer was removed in 0.3.
Same...

Almost positive there is no more attachobjecttoplayer
Reply
#7

I believe you have to attach objects when a player is streamed in.

You have your offsets as the players position; they are 'offsets' not positions, which means the bag is put at co-ordinates (player_x + x_offset, player_y + y_offset, player_z + z_offset). Right now your offsets are the co-ordinates which means the bag is set at the co-ordinates (player_x + player_x, player_y + player_y, player_z + player_z)

pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    new
        bagObject = GetPVarInt(playerid, "bag");

    if (bagObject)
        AttachObjectToPlayer(bagObject, playerid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);

    return 1;
}
You'll also want to change the offset used in your command as well.
Reply
#8

AttachPlayerObjectToPlayer was removed, AttachObjectToPlayer is still there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)