Raised This Month: $32 Target: $400
 8% 

Solved view_as dosent work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJPlaya
Senior Member
Join Date: Nov 2014
Location: Germany
Old 05-20-2020 , 15:47   view_as dosent work?
Reply With Quote #1

Hi,
I am a bit wondered, view_as dosent seem to work as its used to.
I know that it can be dangerous to use, but i should be aware of when its okay and when not.
Using SM1.10 as compiler, these are some Examples:

Code:
int iBuffer;
GetClientAuthId(iClient, AuthId_SteamID64, view_as<char>(iBuffer), 24) // error 035: argument type mismatch (argument 3)
Code:
char cBuffer[24];
if (GetClientAuthId(iClient, AuthId_SteamID64, cBuffer, 24))
	g_iClientSteamID64[iClient] = view_as<int>(cBuffer); // error 006: must be assigned to an array
I am unsure why the Compiler isent ignoring the Data Type anymore, you may know why?
__________________
My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux

Last edited by DJPlaya; 05-22-2020 at 14:36.
DJPlaya is offline
Send a message via Skype™ to DJPlaya
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-20-2020 , 17:34   Re: view_as dosent work?
Reply With Quote #2

You might be looking for https://sourcemod.dev/#/clients/func...SteamAccountID ?

What your code is trying to do doesn't make any sense - GetClientAuthId's output is a string, you can't stuff it into an int.
__________________
asherkin is offline
DJPlaya
Senior Member
Join Date: Nov 2014
Location: Germany
Old 05-20-2020 , 21:30   Re: view_as dosent work?
Reply With Quote #3

Ty, i dident known GetSteamAccountID() yet.

Is there a particular Reason why putting the String into an Int dosent work? A SteamID64 always consist of 17 decimal Digits, so theoretically it should work, or?
__________________
My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux
DJPlaya is offline
Send a message via Skype™ to DJPlaya
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 05-21-2020 , 03:48   Re: view_as dosent work?
Reply With Quote #4

String is an array of chars, you can't store array into one single integer variable.
You can convert int to string using IntToString and string to int using StringToInt.
__________________
MAGNAT2645 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-21-2020 , 03:59   Re: view_as dosent work?
Reply With Quote #5

A SteamID64 is a 64-bit unsigned integer, SourcePawn only has 32-bit signed integers, they’re too small to store it.
__________________
asherkin is offline
DJPlaya
Senior Member
Join Date: Nov 2014
Location: Germany
Old 05-22-2020 , 14:35   Re: view_as dosent work?
Reply With Quote #6

TY
__________________
My biggest Projects: Kigen AC Redux, Forlix Floodcheck Redux
DJPlaya is offline
Send a message via Skype™ to DJPlaya
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode