01.10.2013, 13:34
Quote:
I'm not sure why you're bashing every language except C++. They all serve different purposes.
|
Quote:
What's wrong with HTML? What do you think websites should be written with? Some C++ JIT compiler in the web browser that uses 20 frameworks to write "hello world"? |
Quote:
Not sure what you mean with low-level PHP code - PHP is anything but low-level! It's also a much better fit for serving web pages than C++. Think about continuous integration, ease of maintenance, cross-compatibility, and - yes - the learning curve. Anyone can learn to start modifying bits of PHP scripts to fit their needs very quickly, the same can't be said for C++. |
Mostly, I'm just ranting. There are ways to do it right, but it's hard to find someone who knows them, because the so called ease of the language makes them believe they know more than they do and proceed with using bad methods to do everything.
[quote]The same goes for every other language out there. If you don't want a compiler, make your programs on circuit boards.
Quote:
Yes, and it all works silky smooth! Then, in production, you have tons of memory leaks, way too high CPU usage, and other fun stuff. Why is that? Because you only learned C++ to script SA-MP servers, you didn't learn every aspect of C++. You just wanted to write some code! What now? No clue! Where could the errors be? No clue! You didn't write the functions you used. (I don't mean "you" being "Deji") |
The same can be said for PAWN, though... as you said for C++ and I said for PHP. People see that it's easy and don't bother to learn every aspect. And really, the amount of random things I've seen from PAWN makes me believe that it's really got a lot going on which most people aren't aware of. They don't know how it works, they don't know how SA-MP works, they don't even know how GTA works, which is upsetting. But hey, at least they know how to write a class system.
Quote:
C++ is great for SA-MP servers if you're very familiar with it, yes, but Pawn is a much better choice for most people. |
Just for fun, I brought some Playin' Awesome code as a demonstration of how easy C++ is, especially under the SAMPGDK environment which makes it have everything AMX does:
Code:
// SAMP is a namespace which I used to define SAMP-specific stuff, such as the player base structure // Here, if nBestMatch isn't -1, we set the 'type' to an eVehicleType, else we can set it to the invalid vehicle type ID SAMP::eVehicleType type = nBestMatch != -1 ? (SAMP::eVehicleType)(nBestMatch + 400) : SAMP::MAX_VEHICLE_TYPE; // 'type' should now contain the vehicle model found to match the search string if(type >= SAMP::VT_FIRST_TYPE && type < SAMP::MAX_VEHICLE_TYPE) { int i = nBestMatch; // Get the player coordinates float x, y, z; pPlayer->GetPos(x, y, z); // Create the vehicle there and at the players current angle auto pVehicle = new CVehicle(type, x, y, z, pPlayer->GetHeading()); // IMPORTANT: Always confirm vehicles exist after creating them by checking if they're not "wrecked" (dead) if(pVehicle->IsAlive()) { // Plop that player in the driverseat pVehicle->AddDriver(pPlayer); // E.G. "Spawned NRG-500" std::string msg = "Spawned " + std::string(g_szVehicleNames[nBestMatch]); pPlayer->SendMessage(msg.c_str(), GetColour(COLOUR_SUCCESS)); // Add to the debug vehicles list so we can save memory by deleting them when we're not debugging g_DebugVehicles.push_back(pVehicle); } else { // Send the player a client message and delete the vehicle pPlayer->SendMessage("Vehicle limit reached", GetColour(COLOUR_ERROR)); delete pVehicle; } }
It's stuff that could probably be done in PAWN (using really hacky methods) but wouldn't be most of the time, because in order to do something that efficient even in PAWN, you'd have to know the C++ that it's based off.