PVars the problem? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PVars the problem? (
/showthread.php?tid=165026)
PVars the problem? -
willsuckformoney - 03.08.2010
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
Re: PVars the problem? -
willsuckformoney - 03.08.2010
Snarl@@ help
Re: PVars the problem? -
Retardedwolf - 03.08.2010
I think AttachObjectToPlayer was removed in 0.3.
Re: PVars the problem? -
bigcomfycouch - 03.08.2010
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;
}
Re: PVars the problem? -
willsuckformoney - 03.08.2010
didnt help
Re: PVars the problem? -
marharth - 03.08.2010
Quote:
Originally Posted by EllipseRage
I think AttachObjectToPlayer was removed in 0.3.
|
Same...
Almost positive there is no more attachobjecttoplayer
Re: PVars the problem? -
Simon - 03.08.2010
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.
Re: PVars the problem? -
Sergei - 03.08.2010
AttachPlayerObjectToPlayer was removed, AttachObjectToPlayer is still there.