Originally Posted by Luka™
And yes I search for it already
|
Originally Posted by Luka™
why you always said that?
|
Originally Posted by Don Correlli
Quote:
Quote:
|
Originally Posted by snabbo
Can someone does have mischien a script make that your score and money store?
therefore not with a register system if that is possible… in advance thanks: D |
Originally Posted by Skulls
Can someone please make me a Score Saving System I don't know how to Use Dini or whatever
|
Originally Posted by [03
Garsino ]
Quote:
|
Originally Posted by snabbo
Can someone does have mischien a script make that your score and money store?
therefore not with a register system if that is possible… in advance thanks: D |
#include <a_samp>
#include <dutils>
#include <dudb>
#include <dini>
#include <core>
#include <float>
////////////////////////////////////////////////////////////////////////////////
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
////////////////////////////////////////////////////////////////////////////////
forward UpdateStats();
forward OnPlayerRegister(playerid);
forward OnPlayerLogin(playerid);
////////////////////////////////////////////////////////////////////////////////
enum player_account_info
{
logged,
name[MAX_PLAYER_NAME],
money,
score,
perfect,
level,
}
new pInfo[MAX_PLAYERS][player_account_info];
new Kills[MAX_PLAYERS];
////////////////////////////////////////////////////////////////////////////////
public OnPlayerConnect(playerid)
{
pInfo[playerid][logged] = 0;
pInfo[playerid][level] = 0;
pInfo[playerid][money] = 0;
pInfo[playerid][score] = 0;
pInfo[playerid][perfect] = 0;
GetPlayerName(playerid,pInfo[playerid][name],128);
}
////////////////////////////////////////////////////////////////////////////////
public OnPlayerDisconnect(playerid, reason)
{
pInfo[playerid][logged] = 0;
pInfo[playerid][level] = 0;
pInfo[playerid][money] = 0;
pInfo[playerid][score] = 0;
pInfo[playerid][perfect] = 0;
}
////////////////////////////////////////////////////////////////////////////////
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(login,5,cmdtext);
dcmd(REGISTER,8,cmdtext);
////////////////////////////////////////////////////////////////////////////////
dcmd_login(playerid,params[])
{
new string[265];
new tmp[265];
if(pInfo[playerid][logged] == 1)return SendMsg(playerid, 5000, "~r~Information: ~w~You are already ~r~logged~w~ in!");
if(!strlen(params))return SendMsg(playerid, 5000, "~b~USAGE: ~w~/login [password]");
if (dini_Exists(udb_encode(pInfo[playerid][name])))
{
tmp = dini_Get(udb_encode(pInfo[playerid][name]), "password");
if (udb_hash(params) != strval(tmp))
{
SendMsg(playerid, 5000, "~r~Information: ~w~Wrong password!");
}
else
{
OnPlayerLogin(playerid);
}
}
else
{
format(string, sizeof(string), "The Account %s does not exist in our Database yet, use /register password to register it!", pInfo[playerid][name]);
SendMsg(playerid, 5000, string);
}
return 1;
}
dcmd_REGISTER(playerid,params[])
{
new string[128];
if(pInfo[playerid][logged] == 1)return SendMsg(playerid, 5000, "~r~Information: ~w~You are already logged in");
if(!strlen(params))return SendMsg(playerid, 5000, "~r~Information:~w~ Use /register password");
if (!dini_Exists(udb_encode(pInfo[playerid][name])))
{
format(string, sizeof(string), "The Account %s has been Succesfully registered! You have been automaticly logged in - Password: %s]", pInfo[playerid][name], params);
SendClientMessage(playerid, COLOR_NOTICE, string);
dini_Create(udb_encode(pInfo[playerid][name]));
dini_IntSet(udb_encode(pInfo[playerid][name]), "password", udb_hash(params));
OnPlayerRegister(playerid);
OnPlayerLogin(playerid);
}
else
{
format(string, sizeof(string), "~r~Information: ~w~%s is already registered!", pInfo[playerid][name]);
SendMsg(playerid, 5000, string);
}
return 1;
}
public OnPlayerLogin(playerid)
{
new string[265];
pInfo[playerid][logged] = 1;
pInfo[playerid][money] = dini_Int(udb_encode(pInfo[playerid][name]), "money");
pInfo[playerid][score] = dini_Int(udb_encode(pInfo[playerid][name]), "score");
pInfo[playerid][level] = dini_Int(udb_encode(pInfo[playerid][name]), "level");
pInfo[playerid][perfect] = dini_Int(udb_encode(pInfo[playerid][name]), "perfect");
format(string, sizeof(string), "~r~Information: ~w~your now logged in! [~r~Score: ~w~%d] [~r~Admin Level: ~w~%d] [~r~Premium Member:~w~ %d] [~r~Money: ~w~%d]", pInfo[playerid][score], pInfo[playerid][level], pInfo[playerid][perfect], pInfo[playerid][money]);
SendMsg(playerid, 5000, string);
GivePlayerMoney(playerid,pInfo[playerid][money]);
SetPlayerScore(playerid,pInfo[playerid][score]+GetPlayerScore(playerid));
}
////////////////////////////////////////////////////////////////////////////////
public OnPlayerRegister(playerid)
{
dini_IntSet(udb_encode(pInfo[playerid][name]), "money", pInfo[playerid][money]);
dini_IntSet(udb_encode(pInfo[playerid][name]), "score", pInfo[playerid][score]);
dini_IntSet(udb_encode(pInfo[playerid][name]), "level", 0);
dini_IntSet(udb_encode(pInfo[playerid][name]), "perfect", 0);
}
////////////////////////////////////////////////////////////////////////////////
public UpdateStats()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
pInfo[i][money] = GetPlayerMoney(i);
pInfo[i][score] = GetPlayerScore(i);
if(pInfo[i][logged] == 1)
{
dini_IntSet(udb_encode(pInfo[i][name]), "perfect", pInfo[i][perfect]);
dini_IntSet(udb_encode(pInfo[i][name]), "money", pInfo[i][money]);
dini_IntSet(udb_encode(pInfo[i][name]), "score", pInfo[i][score]);
dini_IntSet(udb_encode(pInfo[i][name]), "level", pInfo[i][level]);
}
}
}
Originally Posted by ♣ Joker ♠
pawn Код:
pawn Код:
pawn Код:
pawn Код:
|
Originally Posted by Zimon95
Hello I need a /rob command only if the player is in a 24/7 and when a player robs all the players have to wait 1 hour to remake a rob. Thank you!
|
dcmd_rob(playerid, params[])
{
new userid, string[128], targetsname[MAX_PLAYER_NAME], money, muggersname[MAX_PLAYER_NAME];
if (sscanf(params, "u", userid)) SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /mask [playerid]");
else
{
if(IsPlayerConnected(userid))
{
GetPlayerMoney(userid);
if(GetDistanceBetweenPlayers(playerid, userid) > 3)
{
SendClientMessage(playerid, COLOR_WHITE, "You're not close enough.");
return 1;
}
if(money < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That player doesn't have enough money to rob from. (0)");
return 1;
}
GetPlayerName(playerid, muggersname, sizeof(muggersname));
GetPlayerName(userid, targetsname, sizeof(targetsname));
format(string, sizeof(string), "You have robbed $%d, from %s.", money, targetsname);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have been 'mugged'! You have lost $%d, %s stole it.", money, muggersname);
SendClientMessage(playerid, COLOR_WHITE, string);
GivePlayerMoney(playerid, money);
}
}
return 1;
Originally Posted by Guso
Since i don't know how to get a actual cars position
|