07.03.2011, 11:12
Hey guys. Im still using the SetPlayerHoldingObject which had been used in 0.3b on my gamemode, and i want to upgrade it to the 0.3c feature with the 5 slots. (currently i have a define, that when SetPlayerHoldingObject is used, it is attached to slot 1.
The usage currently is:
/attach <modelid> <bone> <x> <y> <z> <rotx> <roty> <rotz> <comment>
I want it to work like that:
/attach <slot> <modelid> <bone> <x> <y> <z> <rotx> <roty> <rotz> <comment>
And the /unattach command currently uses StopPlayerHoldingObject
I want it to work like that:
/unattach -> unattaches ANYHING, from every slot (if i habe 5 objects atatched and i do /unattach, it should
remove them all, not like on other servers when you have to /unattach slot 1, /unattach slot 2, /unattach slot 3 blahblah...
My defines (should not be changed if possible, cuz i have other commands using the SetPlayerHolding ojects which should stay, the 7attach is for admins only for now.)
Here are the pawno codes, please can anyone rescript it, i rly have no clue what to change, cuz i never dealt with dcmd's, on only had the normal strcmnds, and this here is a big to hard & i dont wanna test it 20 ages long.
And here the /unattach command
Thx for any help.
The usage currently is:
/attach <modelid> <bone> <x> <y> <z> <rotx> <roty> <rotz> <comment>
I want it to work like that:
/attach <slot> <modelid> <bone> <x> <y> <z> <rotx> <roty> <rotz> <comment>
And the /unattach command currently uses StopPlayerHoldingObject
I want it to work like that:
/unattach -> unattaches ANYHING, from every slot (if i habe 5 objects atatched and i do /unattach, it should
remove them all, not like on other servers when you have to /unattach slot 1, /unattach slot 2, /unattach slot 3 blahblah...
My defines (should not be changed if possible, cuz i have other commands using the SetPlayerHolding ojects which should stay, the 7attach is for admins only for now.)
Код:
#define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1,%2,%3,%4,%5,%6,%7,%8,%9) #define StopPlayerHoldingObject(%1) RemovePlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1) #define IsPlayerHoldingObject(%1) IsPlayerAttachedObjectSlotUsed(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)
Код:
dcmd_attach(playerid, params[]) { if(PlayerInfo[playerid][pTester] != 3) return SendClientMessage(playerid, COLOR_GREY, "* You are not authorized to use this!!"); new modelid,bone,Float:fX,Float:fY,Float:fZ,Float:fRX,Float:fRY,Float:fRZ; new comment[64]; if(sscanf(params, "iiffffffs", modelid, bone, fX,fY,fZ,fRX,fRY,fRZ,comment)) return SendClientMessage(playerid, 0xFF6600FF,"Correct Usage: \"/attach <modelid> <bone> <x> <y> <z> <rotx> <roty> <rotz> <comment>\""); if(Attached[playerid] == 1) { if(IsPlayerHoldingObject(playerid)) { StopPlayerHoldingObject(playerid); SetPlayerHoldingObject(playerid, modelid, bone, fX,fY,fZ,fRX,fRY,fRZ); } else { SetPlayerHoldingObject(playerid, modelid, bone, fX,fY,fZ,fRX,fRY,fRZ); } } else { SetPlayerHoldingObject(playerid, modelid, bone, fX,fY,fZ,fRX,fRY,fRZ); Attached[playerid] = 1; } printf("SetPlayerHoldingObject(playerid, %d,%d,%.01f,%.01f,%.01f,%.01f,%.01f,%.01f);", modelid, bone, fX,fY,fZ,fRX,fRY,fRZ); printf("Comment: %s",comment); return 1; }
Код:
dcmd_unattach(playerid, params[]) { #pragma unused params //if(PlayerInfo[playerid][pTester] != 3) // return SendClientMessage(playerid, COLOR_GREY, "* You are not authorized to use this!!"); if(Attached[playerid] == 1) { if(IsPlayerHoldingObject(playerid)) { StopPlayerHoldingObject(playerid); Attached[playerid] = 0; } else { Attached[playerid] = 0; } } else return SendClientMessage(playerid, 0xFF6600FF,"Error: Nothing is attached to you!"); return 1; }