native SetStructVector(Handle:struct, const String:member[], Float:vec[3]);
| 252 | |
| 253 | //native SetStructVector(Handle:struct, const String:member[], Float:vec[3]); |
| 254 | static cell_t SetStructVector(IPluginContext *pContext, const cell_t *params) |
| 255 | { |
| 256 | Handle_t hndl = static_cast<Handle_t>(params[1]); |
| 257 | HandleError err; |
| 258 | HandleSecurity sec; |
| 259 | |
| 260 | sec.pOwner = NULL; |
| 261 | sec.pIdentity = myself->GetIdentity(); |
| 262 | |
| 263 | StructHandle *pHandle; |
| 264 | if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle)) |
| 265 | != HandleError_None) |
| 266 | { |
| 267 | return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err); |
| 268 | } |
| 269 | |
| 270 | char *member; |
| 271 | pContext->LocalToString(params[2], &member); |
| 272 | |
| 273 | Vector value; |
| 274 | |
| 275 | cell_t *addr; |
| 276 | pContext->LocalToPhysAddr(params[3], &addr); |
| 277 | |
| 278 | value.x = sp_ctof(addr[0]); |
| 279 | value.y = sp_ctof(addr[1]); |
| 280 | value.z = sp_ctof(addr[2]); |
| 281 | |
| 282 | if (!pHandle->SetVector(member, value)) |
| 283 | { |
| 284 | return pContext->ThrowNativeError("Invalid member, or incorrect data type"); |
| 285 | } |
| 286 | |
| 287 | return 1; |
| 288 | } |
| 289 | |
| 290 | //native GetStructString(Handle:struct, const String:member[], String:value[], maxlen); |
| 291 | static cell_t GetStructString(IPluginContext *pContext, const cell_t *params) |
nothing calls this directly
no test coverage detected