Hello, I'm releasing this Blank mode of mine, I can't test it though I'd be glad if someone could for me.
Anyway, this gamemode is to show you how certain things are created, variables and stuff, basically a general concept of how pawn scripts can be created. I couldn't do what I really wished to do since there are hardly any functions, dammit, I may not have updated.
I've added a coin system (Yes I know, it's EXTREMELY easy!) Though thats ment to show you the concept of creating variables and subtracting them, feel free to point out suggestions! I can try to add them. The includes I am using are the fairly old ones (last updated the includes was in JUNE)
Removed some variables, found them worthless and just byte wasting, better off editing it rather than making a new string to input data inside.
Loops are also included in the script, some usages on reseting a variable is there.
Code C++:/* * * Cash script by Lorenc * * Free to use and claim, just shows * a Basic concept of creating * Variables and how to manage them * * Version: 0.1b and supports nothing but console print messages. * */ #include <vaultmp> #define playerid clientID // Needed for me xD. #define MAX_PLAYERS 200 // CHANGE TO SERVER SLOTS! #define Variable:%1<%2> %1[%2 char] // Efficent way of creating variables define by me #define MAX_PLAYER_NAME 24 // Don't know the limit! #define INVALID_PLAYER_ID 65535 // Hopefully this will take place in the invalid playerid action #define loopPlayers(%1) for(new %1; %1 < MAX_PLAYERS; %1++) // Easy looping going through the MAX_PLAERS new Variable:Money<MAX_PLAYERS>; stock ReturnPlayerName(playerid) { new pName[MAX_PLAYER_NAME] = "Invalid Player ID"; if(playerid == INVALID_PLAYER_ID) return pName; GetPlayerName(playerid, pName); return pName; } main() { timestamp(); SetServerName("My Vault MP server"); new map[14]; if (!IsNewVegas()) { map = "the wasteland"; } else { map = "mojave desert"; } SetServerMap(map); // The MAP string has been changed to a setting SetServerRule("version", "0.1a"); // Sets the Version rule to 0.1a which it currently is loopPlayers(i) { // Creates a loop, directing to all the player ID's used Money[i] = 0; // Resets the variable } } public OnClientAuthenticate(playerid, const name[], const pwd[]) { timestamp(); return 1; } public OnClientRequestGame(playerid, savegame[], len) { timestamp(); return 1; } public OnPlayerJoin(playerid) { timestamp(); printf("%s(%d) has joined the server!", ReturnPlayerName(playerid), playerid); if(strlen(ReturnPlayerName(playerid)) > MAX_PLAYER_NAME) { printf("%s(%d) has a name larger than "#MAX_PLAYER_NAME" and offically is a loser :P", ReturnPlayerName(playerid), playerid); //Kick(playerid); // Theres no kick function!!! } return 1; } public OnPlayerDeath(playerid) { timestamp(); printf("%s(%d) has died!", ReturnPlayerName(playerid), playerid); if(Money[playerid] >= 1) { Money[playerid] -= 1; printf("%s(%d) has lost 1 dollar!", ReturnPlayerName(playerid), playerid); } return 1; } public OnPlayerDisconnect(playerid) { timestamp(); printf("%s(%d) has left the server!", ReturnPlayerName(playerid), playerid); return 1; }
Indention may seem awful, nothing I can do. SMF doesn't auto Intend code.
I modified not alot, but most of it.
The coin system will not work!!! If you want it to work, you may need to wait for Recycler to create more server functions and update the MP. This is not a huge gamemode, this is just to get some general knowledge to creating a gamemode.
Constructive Criticizem allowed.
Somethings wrong? Post a reply, heads up and have a great day guys.
- Lorenc
PS: Heads up to people wanting to grab a compiler and a server developing kit, check the useful functions section!