SA-MP Forums Archive
C# portation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: C# portation (/showthread.php?tid=620023)



C# portation - POL_george - 25.10.2016

So I have some questions, that I cant understand by simply searching on the ******.

1)How I define a value? In c# I was used to make something like "public int fuel = 100" but here I cant understand how new works, maybe you can help me
2)Sa:mp uses c++, right? Then I can make classes like c# and making me more easy to resolve things? In c# anything works is classes, nothing outside the classes, how work they here? I have all publics and things outside...

P.S: Yes I know, I have 3 stars and things and I don't know the basics? Yes, when I worked I was kinda kid, and I didn't knew what they means, I didn't know English and now, when I have the brain and English understanding, I found samp perfect practicipe platform


Re: C# portation - Vince - 25.10.2016

Pawn does not use types. All variables are 32-bit unsigned integers. Certain tags (like Float:) can change the representation of the variable. All variables are declared using "new". Pawn does not support objects (regrettably). C++ is often used to write plugins but gamemodes are written in Pawn only. There are certain "adapters" in the plugin section that allow you to write in another language but I have no idea what their performance is compared to just regular Pawn.


Re: C# portation - POL_george - 25.10.2016

Hmmm, strange because it looked me like c++ in some points. Maybe it's just derived from? IDK, but still want to make a samp server no matters what


Re: C# portation - thefirestate - 25.10.2016

It's like php and c++ combined together with some major changes. What Vince said is right, you cannot define an variable's type like in c++, for example int hello = 1; . Pretty much everything is created with new hello = 1; for example. If you want to use floats you would do new Float:hello = 1.0; there is also a few other you might need to use like Bool: , 3DText: , DB: or TextFor textdraws not to create arrays saving any sort of characters, they are done in a different way) if you want you can read more about these things over here https://sampwiki.blast.hk/wiki/Scripting_Basics