Log in

View Full Version : Blank-Mode



Lorenc
07-22-2011, 02:48 PM
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.


/*
*
* 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!

GenerationX
09-11-2011, 07:16 AM
God work Lorenc_!

Well done ;)

Dantiko
10-08-2011, 07:55 PM
"Theres no kick function!!!" made me laugh, good work Lorenc.

NeoPhoenix
10-12-2011, 04:45 PM
#define MAX_PLAYERS 200 // CHANGE TO SERVER SLOTS!
#define Variable:%1<%2> %1[%2 char] // Efficent way of creating variables define by me
#define loopPlayers(%1) for(new %1; %1 < MAX_PLAYERS; %1++) // Easy looping going through the MAX_PLAERS
new Variable:Money<MAX_PLAYERS>;

loopPlayers(i) { // Creates a loop, directing to all the player ID's used
Money[i] = 0; // Resets the variable
}

Pretty useless, creating variables there always 0. Also resetting it on main() makes no sense, you should reset em (Money[playerid]) on OnPlayerJoin(playerid). BTW a system saving the money for each player (filefunctions are pawn natives arent they?) would be nice

Lorenc
10-14-2011, 01:32 PM
#define MAX_PLAYERS 200 // CHANGE TO SERVER SLOTS!
#define Variable:%1<%2> %1[%2 char] // Efficent way of creating variables define by me
#define loopPlayers(%1) for(new %1; %1 < MAX_PLAYERS; %1++) // Easy looping going through the MAX_PLAERS
new Variable:Money<MAX_PLAYERS>;

loopPlayers(i) { // Creates a loop, directing to all the player ID's used
Money[i] = 0; // Resets the variable
}

Pretty useless, creating variables there always 0. Also resetting it on main() makes no sense, you should reset em (Money[playerid]) on OnPlayerJoin(playerid). BTW a system saving the money for each player (filefunctions are pawn natives arent they?) would be nice


They can return something other than null, depending on how much data is contained inside "Money"; If it exceeds '0xFF' (255) then it'll return either '-1' or '0xFFFF'... I may of forgot to reset it however, I also forgot to mention that, this variable uses a 8 bit array, max is number you can hold is '0xFF', without the char array, I think it's something like '0xFFFFFF', one large int ;)

It's been a while since this has been updated, since then, there was nothing special to do with vault-tec. I see that there is changes and I could script something more powerful then this... I'll make a file writer for the community sometime

"July 22, 2011, 03:48:52 pm" < Date!

NeoPhoenix
10-14-2011, 09:10 PM
"July 22, 2011, 03:48:52 pm" < Date!
Ye, I´m sorry :P