24.05.2009, 08:52
Hi,
Okay, I'm not really stuck with a command, but I'm wondering how I could do this better. I'm using AttachPlayerToObject or whatever it's called to make a /stick command. Now when unsticking it, SpawnPlayer(playerid) and then setting the player's pos to that location fails as he still has the object attached to him.
Only thing working is SetPlayerHealth(playerid, 0 );, but when using that animation the object moves a little bit forwards (due to the player falling down).
Commands:
Okay then I tried using INVALID_PLAYER_ID, but that didn't work either, so any suggestions?
Thanks.
Okay, I'm not really stuck with a command, but I'm wondering how I could do this better. I'm using AttachPlayerToObject or whatever it's called to make a /stick command. Now when unsticking it, SpawnPlayer(playerid) and then setting the player's pos to that location fails as he still has the object attached to him.
Only thing working is SetPlayerHealth(playerid, 0 );, but when using that animation the object moves a little bit forwards (due to the player falling down).
Commands:
Код:
dcmd_stick(playerid, params[]) { if(EditingObject[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You aren't editing any objects!"); if(StickedToObject[playerid] == 1) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You are already sticked to the object!"); StickedToObject[playerid] = 1; AttachObjectToPlayer( Object, playerid, 2.0, 2.0, 0.0, 0, 1.5, 2 ); #pragma unused params return 1; } dcmd_unstick(playerid, params[]) { new Float:Pxx, Float:Pyy, Float:Pzz; if(EditingObject[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You aren't editing any objects!"); if(StickedToObject[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You aren't sticked to an object!"); StickedToObject[playerid] = 0; SendClientMessage(playerid, COLOR_GREEN, "* You have been released from your object!"); AttachObjectToPlayer( Object, INVALID_PLAYER_ID, 2.0, 2.0, 0.0, 0, 1.5, 2 ); GetPlayerPos(playerid, Pxx, Pyy, Pzz); GetObjectRot(playerid, xR, yR, zR); oX = Pxx - 0.000; oY = Pyy - 2.000; oZ = Pzz - 0.001; SetObjectPos(Object, oX, oY, oZ); SetObjectRot(Object, xR, yR, zR); #pragma unused params return 1; }
Thanks.