[Tool/Web/Other] SetPlayerAttachedObject - Aim Fix
#1

Well, this is a cool thing to add to your server. This will remove attached objects to a player as that player is aiming. Then it will return them back. It only works for the SetPlayerAttachedObject feature, not the AttachObjectToPlayer feature.

Код:
//This isn't a filterscript, nor an include. You must add this to your gamemode, etc..
//Change all SetPlayerAttachedObject(...) with SetPlayerAttachedObjectE(...), except the one I have not.
//Change all RemovePlayerAttachedObject(...) with RemovePlayerAttachedObjectE(...), except the one I have not.
//You are done. Be nice and do good work, return0 aka Einstein
Pastebin: http://pastebin.com/qcxh26XX



Here is a video:
[ame]http://www.youtube.com/watch?v=gg4vc-BMolY[/ame]




In order for it to work as it should, follow the instructions.

Any questions or concerns? Reply here!
Reply
#2

Look's slow reloading objects, but nice.
Reply
#3

Quote:
Originally Posted by tyler12
Посмотреть сообщение
Look's slow reloading objects, but nice.
Oh, the timer I use is every 1500 milliseconds.. that's the reason why, because I was on a slow test server.
Reply
#4

Quote:
Originally Posted by return0
Посмотреть сообщение
Oh, the timer I use is every 1500 milliseconds.. that's the reason why, because I was on a slow test server.
OnPlayerKeyStateChange

if(PRESSED( KEY_AIM ))
hideObjects;
if(RELEASED( KEY_AIM ))
showObjects;
Reply
#5

This is pretty cool, actually. Would make sense if someone made this to load in like half a second or something lol. But yeah, interesting.
Reply
#6

Updated... better sync.
Reply
#7

Quote:

D:\My Documents\Downloads\Documents\ZombieR3.3\filterscr ipts\aimb.pwn(32) : warning 235: public function lacks forward declaration (symbol "OnplayerConnect")
D:\My Documents\Downloads\Documents\ZombieR3.3\filterscr ipts\aimb.pwn(62) : error 017: undefined symbol "PlayerInfo"
D:\My Documents\Downloads\Documents\ZombieR3.3\filterscr ipts\aimb.pwn(62) : warning 215: expression has no effect
D:\My Documents\Downloads\Documents\ZombieR3.3\filterscr ipts\aimb.pwn(62) : error 001: expected token: ";", but found "]"
D:\My Documents\Downloads\Documents\ZombieR3.3\filterscr ipts\aimb.pwn(62) : error 029: invalid expression, assumed zero
D:\My Documents\Downloads\Documents\ZombieR3.3\filterscr ipts\aimb.pwn(62) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

help me
Reply
#8

Quote:
Originally Posted by Borntobie
Посмотреть сообщение
help me
If you haven't fixed that yet, pasting the lines may help us a little to figure out what the problem may be.
Reply
#9

Quote:

D:\My Documents\Downloads\Documents\Zombie0.3e\gamemodes \Untitled.pwn(62) : error 017: undefined symbol "PlayerInfo"
D:\My Documents\Downloads\Documents\Zombie0.3e\gamemodes \Untitled.pwn(62) : warning 215: expression has no effect
D:\My Documents\Downloads\Documents\Zombie0.3e\gamemodes \Untitled.pwn(62) : error 001: expected token: ";", but found "]"
D:\My Documents\Downloads\Documents\Zombie0.3e\gamemodes \Untitled.pwn(62) : error 029: invalid expression, assumed zero
D:\My Documents\Downloads\Documents\Zombie0.3e\gamemodes \Untitled.pwn(62) : fatal error 107: too many error messages on one line

62 :
Quote:

}
PlayerInfo[playerid][Attachments][2] = 1;
}

enum :
Quote:

enum pATTACHMENTS
{
Exists,
ModelID,
BoneID,
FloatOffsetX,
FloatOffsetY,
FloatOffsetZ,
FloatRotX,
FloatRotY,
FloatRotZ,
FloatScaleX,
FloatScaleY,
FloatScaleZ
};
new pAttachments[MAX_PLAYERS][10][pATTACHMENTS];
new Attachments[MAX_PLAYERS];

how ?
Reply
#10

Borntobie, you're using PlayerInfo instead of pAttachments. If you just copy and paste the entire thing without changing it, just like I have it in my server, it will work fine.
Reply
#11

Nice work, but why not as an include? You could hook things up and make it as a pretty include in which others could include it into their scripts.
Reply
#12

Quote:

Nice work, but why not as an include? You could hook things up and make it as a pretty include in which others could include it into their scripts

This ^

But cool work as always mate .^-^
Reply
#13

Quote:
Originally Posted by Dr.Einstein
Посмотреть сообщение
Borntobie, you're using PlayerInfo instead of pAttachments. If you just copy and paste the entire thing without changing it, just like I have it in my server, it will work fine.
I still do not understand ... I edit this script so that it works right away )
Quote:

#include <a_samp>

//This isn't a filterscript, nor an include. You must add this to your gamemode, etc..
//Change all SetPlayerAttachedObject(...) with SetPlayerAttachedObjectE(...), except the one I have not.
//Change all RemovePlayerAttachedObject(...) with RemovePlayerAttachedObjectE(...), except the one I have not.
//You are done. Be nice and do good work, return0 aka Einstein
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

enum pATTACHMENTS
{
Exists,
ModelID,
BoneID,
FloatOffsetX,
FloatOffsetY,
FloatOffsetZ,
FloatRotX,
FloatRotY,
FloatRotZ,
FloatScaleX,
FloatScaleY,
FloatScaleZ
};
new pAttachments[MAX_PLAYERS][10][pATTACHMENTS];
new Attachments[MAX_PLAYERS];



public OnplayerConnect(playerid)
{
Attachments[playerid] = 0;
for(new i = 0; i < 10; i++)
pAttachments[playerid][i][Exists] = 0;
return 1;
}

public OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid,
Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
Float:fRotX, Float:fRotY, Float:fRotZ,
Float:fScaleX, Float:fScaleY, Float:fScaleZ )
{
SetPlayerAttachedObjectE(playerid,index,modelid,bo neid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ, fScaleX,fScaleY,fScaleZ);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(PRESSED(KEY_HANDBRAKE))
{
if(GetPlayerWeapon(playerid) == WEAPON_ROCKETLAUNCHER || GetPlayerWeapon(playerid) == WEAPON_SNIPER
|| GetPlayerWeapon(playerid) == WEAPON_CAMERA || GetPlayerWeapon(playerid) == WEAPON_HEATSEEKER)
{
for(new i=0; i<10; i++)
{
RemovePlayerAttachedObject(playerid, i);
}
}
PlayerInfo[playerid][Attachments][2] = 1;
}
if(RELEASED(KEY_HANDBRAKE))
{
for(new i=0; i<10; i++)
{
RemovePlayerAttachedObject(playerid, i);
if(pAttachments[playerid][i][Exists])SetPlayerAttachedObject(playerid,i,pAttachments[playerid][i][ModelID],pAttachments[playerid][i][BoneID],
pAttachments[playerid][i][pOffsetX],pAttachments[playerid][i][pOffsetY],pAttachments[playerid][i][pOffsetZ],
pAttachments[playerid][i][pRotX],pAttachments[playerid][i][pRotY],pAttachments[playerid][i][pRotZ],
pAttachments[playerid][i][pScaleX],pAttachments[playerid][i][pScaleY],pAttachments[playerid][i][pScaleZ]);
}
}
}
return 1;
}

stock RemovePlayerAttachedObjectE(playerid, index)
{
pAttachments[playerid][index][Exists] = 0;
RemovePlayerAttachedObject(playerid, index);
}
stock SetPlayerAttachedObjectE(playerid,index,modelid,bo neid,
Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
Float:fRotX, Float:fRotY, Float:fRotZ,
Float:fScaleX, Float:fScaleY, Float:fScaleZ )
{
pAttachments[playerid][index][Exists] = 1;
pAttachments[playerid][index][ModelID] = modelid;
pAttachments[playerid][index][BoneID] = boneid;
pAttachments[playerid][index][pOffsetX] = fOffsetX;
pAttachments[playerid][index][pOffsetY] = fOffsetY;
pAttachments[playerid][index][pOffsetZ] = fOffsetZ;
pAttachments[playerid][index][pRotX] = fRotX;
pAttachments[playerid][index][pRotY] = fRotY;
pAttachments[playerid][index][pRotZ] = fRotZ;
pAttachments[playerid][index][pScaleX] = fScaleX;
pAttachments[playerid][index][pScaleY] = fScaleY;
pAttachments[playerid][index][pScaleZ] = fScaleZ;

SetPlayerAttachedObject(playerid,index,modelid,bon eid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,f ScaleX,fScaleY,fScaleZ);
}

stock IsPlayerAiming(playerid) {
new anim = GetPlayerAnimationIndex(playerid);
if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
(anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
return 0;
}

Reply
#14

When I'm free, I will turn this into an include.
Reply
#15

coooool
Reply
#16

Quote:
Originally Posted by Dr.Einstein
Посмотреть сообщение
When I'm free, I will turn this into an include.
agree .. please help me okay .. I needed this stuff
Reply
#17

Looking very good, thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)