/*
*
* 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;
}