Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
text
Languages:
Russian
Size:
10K - 100K
Tags:
code
License:
File size: 5,065 Bytes
ea562e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
Fakemeta function: PHP Code: EngFunc_GetBonePosition Description: The function allows to get the bone positions of an entity. This is best used on getting specific player origin points. These are the bones that a player has. Code: Bone 1 Name: "Bip01" Bone 2 Name: "Bip01 Pelvis" Bone 3 Name: "Bip01 Spine" Bone 4 Name: "Bip01 Spine1" Bone 5 Name: "Bip01 Spine2" Bone 6 Name: "Bip01 Spine3" Bone 7 Name: "Bip01 Neck" Bone 8 Name: "Bip01 Head" Bone 9 Name: "Bone01" Bone 10 Name: "Bip01 L Clavicle" Bone 11 Name: "Bip01 L UpperArm" Bone 12 Name: "Bip01 L Forearm" Bone 13 Name: "Bip01 L Hand" Bone 14 Name: "Bip01 L Finger0" Bone 15 Name: "Bip01 L Finger01" Bone 16 Name: "Bip01 L Finger1" Bone 17 Name: "Bip01 L Finger11" Bone 18 Name: "-- L knuckle" Bone 19 Name: "-- L Forearm twist" Bone 20 Name: "-- L wrist" Bone 21 Name: "-- L Elbow" Bone 22 Name: "-- L bicep twist" Bone 23 Name: "-- L shoulder outside" Bone 24 Name: "-- L Shoulder inside" Bone 25 Name: "Bip01 R Clavicle" Bone 26 Name: "Bip01 R UpperArm" Bone 27 Name: "Bip01 R Forearm" Bone 28 Name: "Bip01 R Hand" Bone 29 Name: "Bip01 R Finger0" Bone 30 Name: "Bip01 R Finger01" Bone 31 Name: "Bip01 R Finger1" Bone 32 Name: "Bip01 R Finger11" Bone 33 Name: "-- R knuckle" Bone 34 Name: "-- R wrist" Bone 35 Name: "-- R forearm twist" Bone 36 Name: "-- R Elbow" Bone 37 Name: "-- R bicep twist" Bone 38 Name: "-- R Shoulder inside" Bone 39 Name: "-- R shoulder outside" Bone 40 Name: "-- Neck smooth" Bone 41 Name: "-- R Butt" Bone 42 Name: "-- L butt" Bone 43 Name: "Bip01 L Thigh" Bone 44 Name: "Bip01 L Calf" Bone 45 Name: "Bip01 L Foot" Bone 46 Name: "Bip01 L Toe0" Bone 47 Name: "-- L ankle" Bone 48 Name: "-- L Knee" Bone 49 Name: "Bip01 R Thigh" Bone 50 Name: "Bip01 R Calf" Bone 51 Name: "Bip01 R Foot" Bone 52 Name: "Bip01 R Toe0" Bone 53 Name: "-- R Ankle" Bone 54 Name: "-- R Knee" Bone 55 Name: "Bomb" This image shows the locations of the bones, they are marked through blue points. The red point is the player origin. [IMG]http://img507.**************/img507/7762/playerskeleton.jpg[/IMG] Usage: PHP Code: // ENTITY is the player entity id // BONE_NUMBER you have to choose from the list above // bone_origin[3] is the vector where we save the bone origin // bone_angles[3] the vector that holds the angles of the bone. engfunc(EngFunc_GetBonePosition, ENTITY, BONE_NUMBER, Float:bone_origin[3], Float:bone_angles[3]) Useful Stocks: These stocks are made for CS/CZ you need to port them to other mods. This gets the hitgroup of the bone. PHP Code: #define BONE_HIT_HEAD 8 #define BONE_HIT_CHEST 6 #define BONE_HIT_STOMACH 4 #define BONE_HIT_LEFTARM 24 #define BONE_HIT_RIGHTARM 39 #define BONE_HIT_LEFTLEG 48 #define BONE_HIT_RIGHTLEG 54 #define HEAD_NECK 40 #define BONE_L_BUTT 41 #define BONE_R_BUTT 42 stock get_bone_hitgroup(number) { switch (number) { case HEAD_NECK: { return HIT_HEAD } case BONE_L_BUTT: { return HIT_LEFTLEG } case BONE_R_BUTT: { return HIT_RIGHTLEG } } if (1 <= number <= BONE_HIT_STOMACH) return HIT_STOMACH if (BONE_HIT_STOMACH < number <= BONE_HIT_CHEST) return HIT_CHEST if (BONE_HIT_CHEST < number <= BONE_HIT_HEAD) return HIT_HEAD if (BONE_HIT_HEAD < number <= BONE_HIT_LEFTARM) return HIT_LEFTARM if (BONE_HIT_LEFTARM < number <= BONE_HIT_RIGHTARM) return HIT_RIGHTARM if (BONE_HIT_RIGHTARM < number <= BONE_HIT_LEFTLEG) return HIT_LEFTLEG if (BONE_HIT_LEFTLEG < number <= BONE_HIT_RIGHTLEG) return HIT_RIGHTLEG return HIT_GENERIC } This gets the closest bone to the gunshot [Use this in FM_TraceLine and Ham_TraceAttack PHP Code: #define DISTANCE_CLEAR_HIT 2.0 stock find_closest_bone_to_gunshot(victim, Float:endtrace[3]) { new Float:angles[3], Float:origin[3], Float:dist = 9999999.99, Float:curorigin[3], bone_nr for (new i=1;i<=54;i++) { // Get the bone position engfunc(EngFunc_GetBonePosition, victim, i, curorigin, angles) // Calculate the distance vector xs_vec_sub(curorigin, endtrace, angles) // If this is smaller than the last small distance remember the value! if (xs_vec_len(angles) <= dist) { origin = curorigin dist = xs_vec_len(angles) bone_nr = i } // If distance is smaller than CLEARHIT! Break (We accept the last value!) if (dist <= DISTANCE_CLEAR_HIT) { break } } // Return the bone return bone_nr } |