native GetStructFloat(Handle:struct, const String:member[], &Float:value);
| 157 | |
| 158 | //native GetStructFloat(Handle:struct, const String:member[], &Float:value); |
| 159 | static cell_t GetStructFloat(IPluginContext *pContext, const cell_t *params) |
| 160 | { |
| 161 | Handle_t hndl = static_cast<Handle_t>(params[1]); |
| 162 | HandleError err; |
| 163 | HandleSecurity sec; |
| 164 | |
| 165 | sec.pOwner = NULL; |
| 166 | sec.pIdentity = myself->GetIdentity(); |
| 167 | |
| 168 | StructHandle *pHandle; |
| 169 | if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle)) |
| 170 | != HandleError_None) |
| 171 | { |
| 172 | return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err); |
| 173 | } |
| 174 | |
| 175 | char *member; |
| 176 | pContext->LocalToString(params[2], &member); |
| 177 | |
| 178 | float value; |
| 179 | |
| 180 | if (!pHandle->GetFloat(member, &value)) |
| 181 | { |
| 182 | return pContext->ThrowNativeError("Invalid member, or incorrect data type"); |
| 183 | } |
| 184 | |
| 185 | return sp_ftoc(value); |
| 186 | } |
| 187 | |
| 188 | //native SetStructFloat(Handle:struct, const String:member[], Float:value); |
| 189 | static cell_t SetStructFloat(IPluginContext *pContext, const cell_t *params) |
nothing calls this directly
no test coverage detected