KillEMSQueue(playerid); ClearAnimations(playerid);
CMD:aduty(playerid, params[])
{
if(!PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, -1, "This is an admin only command!");
new var = PlayerInfo[playerid][pAdminDuty];
ResetPlayerWeapons(playerid);
if(!var)
{
AdminTexxt[playerid] = Create3DTextLabel("Admininstrator[ON DUTY] {FF0000}(DO NOT ATTACK!)", 0xFFFF00FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(AdminTexxt[playerid], playerid, 0.0, 0.0, 0.5);
GivePlayerValidWeapon(playerid, 24, 99999);
GivePlayerValidWeapon(playerid, 43, 60000);
GivePlayerValidWeapon(playerid, 24, 60000);
GivePlayerValidWeapon(playerid, 31, 99999);
GivePlayerValidWeapon(playerid, 32, 99999);
GivePlayerValidWeapon(playerid, 27, 99999);
GivePlayerValidWeapon(playerid, 34, 99999);
GivePlayerValidWeapon(playerid, 38, 99999);
SetPlayerColor(playerid, COLOR_ADUTY);
}
else
{
SetPlayerToTeamColor(playerid);
Delete3DTextLabel(AdminTexxt[playerid]);
}
SendClientMessageEx(playerid, COLOR_BLUE, (var) ? ("You are now off admin duty!") : ("You are now on Administrator duty!"));
//SetPlayerName(playerid, (var) ? (PlayerInfo[playerid][pNormalName]) : (PlayerInfo[playerid][pAdminName]));
PlayerInfo[playerid][pAdminDuty] = (var) ? (0) : (1);
//SetPlayerHealth(playerid, (var) ? (Float:(0x7F800000)) : Float:(0x7F800000));
SetPlayerHealth(playerid, (var) ? (100) : (100000));
SetPlayerArmour(playerid, (var) ? (0) : (9999999));
new szMessage[75];
format(szMessage, sizeof(szMessage), (var) ? ("Administrator %s is now {800000}OFF {FF0000}Duty!") : ("Administrator %s is now {00FF00}ON {FF0000}Duty!"), GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_REALRED, szMessage);
return 1;
}
CMD:setadminname(playerid, params[])
{
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "YOU ARE NOT LOGGED IN!!");
if(PlayerInfo[playerid][pAdmin] > 99998)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new giveplayerid, name[32];
if(sscanf(params, "us[32]", giveplayerid, name))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadminname [playerid/partofname] [name]");
return 1;
}
if(PlayerInfo[giveplayerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin.");
return 1;
}
if(PlayerInfo[giveplayerid][pAdminDuty] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
return 1;
}
new length = strlen(name);
if(length < 3 || length > 20)
{
SendClientMessage(playerid, COLOR_WHITE, "The name can't less than 3 characters or more than 20 characters.");
return 1;
}
if(strfind(name, "_", true) != -1)
{
SendClientMessage(playerid, COLOR_WHITE, "The admin name must be one name. There can't be an underscore in the name.");
return 1;
}
if(strcmp(name, "AAS", true) == 0 && PlayerInfo[playerid][pAdmin] < 6) {
SendClientMessage(playerid, COLOR_WHITE, "AAS");
return 1;
}
new string[128];
new str[128];
format(str, sizeof(str), "Adminstrator %s has setted your admin name to '%s' you may now go /aduty", GetPlayerNameEx(playerid), name);
format(string, sizeof(string), "AdmCmd: %s has set %s's admin name to '%s'.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), name);
ABroadCast(COLOR_LIGHTRED, string, 1);
SendClientMessage(giveplayerid, COLOR_WHITE, str);
PlayerInfo[giveplayerid][pAdminNameSet] = 1;
format(PlayerInfo[giveplayerid][pAdminName], 32, name);
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}
new bool:changed[MAX_PLAYERS];
CMD:setadminname(playerid, params[])
{
new id;
new name[128];
if(sscanf(params,"us[128]",id,name)) return SendClientMessage(playerid, -1, "/setadminname [ID] (Name)");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not a RCON admin");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Player is not connected");
SetPlayerName(targetid, name);
changed[playerid] = true;
return 1;
}
I tried to understand
Anyway PHP код:
PHP код:
|
CMD:aduty(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 1) { if(PlayerInfo[playerid][pAdminDuty] == 0) { new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); new string[120]; if(PlayerInfo[playerid][pAdminNameSet] == 0) { return SendClientMessage(playerid, -1, "You must set your admin name before going on duty.( /aname )"); } // SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); format(string, sizeof(string), "** Administrator %s is now on admin duty. (/report for assistance) **", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); PlayerInfo[playerid][pAdminNameSet] = 1; PlayerInfo[playerid][pAdminDuty] = 1; SetPlayerHealth(playerid, 100000); SetPlayerArmour(playerid, 100000); format(string, sizeof(string), "users/%s.ini", playername); fremove(string); OnPlayerStatsUpdate(playerid); return 1; } else if(PlayerInfo[playerid][pAdminDuty] == 1) { new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); new string[120]; if(PlayerInfo[playerid][pNormalNameSet] == 0) { return SendClientMessage(playerid, -1, "You must set your player name before going off duty.( /playername )"); } format(string, sizeof(string), "** Administrator %s is now off admin duty. **", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); PlayerInfo[playerid][pNormalNameSet] = 1; PlayerInfo[playerid][pAdminDuty] = 0; SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); format(string, sizeof(string), "users/%s.ini", playername); fremove(string); SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]); OnPlayerStatsUpdate(playerid); return 1; } } return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN); } CMD:aname(playerid, params[]) { new string[150], name[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; if(sscanf(params, "s[24]", name)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /aname [name]"); if(strlen(name) < MAX_PLAYER_NAME) { if (PlayerInfo[playerid][pAdmin] >= 1) { if(!doesAccountExist(name)) { new stringname[50]; new newname[MAX_PLAYER_NAME + 10]; GetPlayerName(playerid, playername, sizeof(playername)); format(stringname, sizeof(stringname), "users/%s.ini", playername); format(newname, sizeof(newname), "users/%s.ini", name); SendClientMessageEx(playerid,COLOR_YELLOW,"Your admin name has been set!"); format(string, sizeof(string), "%s set their admin name to \"%s\"",GetPlayerNameEx(playerid),name); Log("logs/stats.log", string); PlayerInfo[playerid][pAdminNameSet] = 1; strmid(PlayerInfo[playerid][pAdminName], name, 0, strlen(name), 32); fremove(stringname); OnPlayerStatsUpdate(playerid); return 1; } else { SendClientMessageEx(playerid, COLOR_WHITE, "That name is already registered."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't authorised to use this command."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "Your chosen name is too long. Please make it shorter."); } return 1; } CMD:playername(playerid, params[]) { new string[150], name[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; if(sscanf(params, "s[24]", name)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /playername [name]"); if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 1) { if(!doesAccountExist(name)) { new stringname[50]; new newname[MAX_PLAYER_NAME + 10]; GetPlayerName(playerid, playername, sizeof(playername)); format(stringname, sizeof(stringname), "users/%s.ini", playername); format(newname, sizeof(newname), "users/%s.ini", name); SendClientMessageEx(playerid,COLOR_YELLOW,"Your player name has been set!"); format(string, sizeof(string), "%s set their player name to \"%s\"",GetPlayerNameEx(playerid),name); Log("logs/stats.log", string); PlayerInfo[playerid][pNormalNameSet] = 1; strmid(PlayerInfo[playerid][pNormalName], name, 0, strlen(name), 32); fremove(stringname); OnPlayerStatsUpdate(playerid); return 1; } else { SendClientMessageEx(playerid, COLOR_WHITE, "That name is already registered."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't authorised to use this command."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "Mhmm... For some reason you're not connected.."); } return 1; }
Try this, You're lukey if it's work
Код:
CMD:aduty(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 1) { if(PlayerInfo[playerid][pAdminDuty] == 0) { new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); new string[120]; if(PlayerInfo[playerid][pAdminNameSet] == 0) { return SendClientMessage(playerid, -1, "You must set your admin name before going on duty.( /aname )"); } // SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); format(string, sizeof(string), "** Administrator %s is now on admin duty. (/report for assistance) **", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); PlayerInfo[playerid][pAdminNameSet] = 1; PlayerInfo[playerid][pAdminDuty] = 1; SetPlayerHealth(playerid, 100000); SetPlayerArmour(playerid, 100000); format(string, sizeof(string), "users/%s.ini", playername); fremove(string); OnPlayerStatsUpdate(playerid); return 1; } else if(PlayerInfo[playerid][pAdminDuty] == 1) { new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); new string[120]; if(PlayerInfo[playerid][pNormalNameSet] == 0) { return SendClientMessage(playerid, -1, "You must set your player name before going off duty.( /playername )"); } format(string, sizeof(string), "** Administrator %s is now off admin duty. **", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); PlayerInfo[playerid][pNormalNameSet] = 1; PlayerInfo[playerid][pAdminDuty] = 0; SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); format(string, sizeof(string), "users/%s.ini", playername); fremove(string); SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]); OnPlayerStatsUpdate(playerid); return 1; } } return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN); } CMD:aname(playerid, params[]) { new string[150], name[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; if(sscanf(params, "s[24]", name)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /aname [name]"); if(strlen(name) < MAX_PLAYER_NAME) { if (PlayerInfo[playerid][pAdmin] >= 1) { if(!doesAccountExist(name)) { new stringname[50]; new newname[MAX_PLAYER_NAME + 10]; GetPlayerName(playerid, playername, sizeof(playername)); format(stringname, sizeof(stringname), "users/%s.ini", playername); format(newname, sizeof(newname), "users/%s.ini", name); SendClientMessageEx(playerid,COLOR_YELLOW,"Your admin name has been set!"); format(string, sizeof(string), "%s set their admin name to \"%s\"",GetPlayerNameEx(playerid),name); Log("logs/stats.log", string); PlayerInfo[playerid][pAdminNameSet] = 1; strmid(PlayerInfo[playerid][pAdminName], name, 0, strlen(name), 32); fremove(stringname); OnPlayerStatsUpdate(playerid); return 1; } else { SendClientMessageEx(playerid, COLOR_WHITE, "That name is already registered."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't authorised to use this command."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "Your chosen name is too long. Please make it shorter."); } return 1; } CMD:playername(playerid, params[]) { new string[150], name[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; if(sscanf(params, "s[24]", name)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /playername [name]"); if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 1) { if(!doesAccountExist(name)) { new stringname[50]; new newname[MAX_PLAYER_NAME + 10]; GetPlayerName(playerid, playername, sizeof(playername)); format(stringname, sizeof(stringname), "users/%s.ini", playername); format(newname, sizeof(newname), "users/%s.ini", name); SendClientMessageEx(playerid,COLOR_YELLOW,"Your player name has been set!"); format(string, sizeof(string), "%s set their player name to \"%s\"",GetPlayerNameEx(playerid),name); Log("logs/stats.log", string); PlayerInfo[playerid][pNormalNameSet] = 1; strmid(PlayerInfo[playerid][pNormalName], name, 0, strlen(name), 32); fremove(stringname); OnPlayerStatsUpdate(playerid); return 1; } else { SendClientMessageEx(playerid, COLOR_WHITE, "That name is already registered."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't authorised to use this command."); } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "Mhmm... For some reason you're not connected.."); } return 1; } |
PosX,
PosY,
PosZ,
Health,
Armour,
Money,
//And the other add it according to your script i can guess :P
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PlayerInfo[playerid][PosX] = x;
PlayerInfo[playerid][PosY] = y;
PlayerInfo[playerid][PosZ] = z;
new Float:health;
GetPlayerHealth(playerid, health);
PlayerInfo[playerid][Health] = health;
new Float:armour;
GetPlayerArmour(playerid, armour);
PlayerInfo[playerid][Armour] = armour;
PlayerInfo[playerid][Money] = GetPlayerMoney(playerid);
SetPlayerPos(playerid, PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ]);
SetPlayerHealth(playerid, PlayerInfo[playerid][Health]);
SetPlayerArmour(playerid, PlayerInfo[playerid][Armour]);
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
Add in your enum
PHP код:
PHP код:
PHP код:
|
stock AttemptPlayerLogin(playerid, passbuffer[]) {
new
szQuery[225],
szPlayerName[MAX_PLAYER_NAME],
szPlayerName2[MAX_PLAYER_NAME];
GetPlayerName(playerid, szPlayerName, sizeof(szPlayerName));
mysql_real_escape_string(szPlayerName, szPlayerName2, g_MySQLConnections[0]);
format(szQuery, sizeof(szQuery), "SELECT * FROM players WHERE Username = '%s' AND Password = '%s'", szPlayerName2, passbuffer);
mysql_query(szQuery, THREAD_LOGIN_ATTEMPT, playerid, g_MySQLConnections[0]);
return 1;
}
#define DIALOG_REGISTER 500
#define DIALOG_LOGIN 501
#define PATH "/info/%s.ini"
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
public LoadUser_data(playerid,name[],value[])
{ // =========================== Loading User Data from the INI File ================================ //
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pMoney]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Police",PlayerInfo[playerid][pPolice]);
INI_Int("Gang",PlayerInfo[playerid][pGang]);
INI_Int("Horseshoes", PlayerInfo[playerid][pHorseshoes]);
INI_Int("Score", PlayerInfo[playerid][pScore]);
INI_Int("Warnings", PlayerInfo[playerid][pWarnings]);
INI_Int("Dealer", PlayerInfo[playerid][pDealer]);
return 1;
}
forward LoadUser_data(playerid,name[],value[]);
stock UserPath(playerid)
{ // User's Path
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock udb_hash(buf[])
{ // ========== Password Hash ================== //
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(fexist(UserPath(playerid)))
{
fremove(UserPath(playerid));
}
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Account","Welcome to SA-MP Server!\n\n{FF1493}Your account is not found on the server, we hope you enjoy your stay!\n{FF1493}In order to reguster account successfully, Fill in your desired password for the next login:", "Continue", "Leave");
new INI:file = INI_Open(UserPath(playerid));
INI_SetTag(file,"data");
INI_WriteInt(file,"Password",udb_hash(inputtext));
INI_WriteInt(file,"Cash",75000);
INI_WriteInt(file,"Admin",0);
INI_WriteInt(file,"Skin",0);
INI_WriteInt(file,"Score",0);
INI_WriteInt(file,"Police",0);
INI_WriteInt(file,"Gang",0);
INI_WriteInt(file, "Horseshoes", 0);
INI_WriteInt(file,"Warnings",0);
INI_WriteInt(file,"Dealer",0);
INI_Close(file);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
LoggedIn[playerid] = true;
freezed[playerid] = false;
pm[playerid] = true;
}
}
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
SendClientMessage(playerid, 0xFF7F2480,"You have successfully logged in your game account!");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
LoggedIn[playerid] = true;
freezed[playerid] = false;
pm[playerid] = true;
if(PlayerInfo[playerid][pWarnings] == 3)
{
PlayerInfo[playerid][pWarnings] = 0;
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Account","Welcome to SA-MP Server!\n\n{FF1493}Your account is registered on the server, we hope you enjoy your stay!\n{FF1493}In order to log in your account successfully, Fill in your password correctly:\n\n{FF0033}*Password you typed is incorrect","Continue","Leave");
LoggedIn[playerid] = false;
}
}
}
new INI:FILE = INI_Open(UserPath(playerid));
INI_SetTag(FILE,"data");
INI_WriteInt(FILE,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(FILE,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(FILE,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(FILE,"Score",GetPlayerScore(playerid));
INI_WriteInt(FILE,"Police",PlayerInfo[playerid][pPolice]);
INI_WriteInt(FILE,"Gang",PlayerInfo[playerid][pGang]);
INI_WriteInt(FILE, "Horseshoes", PlayerInfo[playerid][pHorseshoes]);
INI_WriteInt(FILE, "Dealer", PlayerInfo[playerid][pDealer]);
INI_WriteInt(FILE, "Warnings", PlayerInfo[playerid][pWarnings]);
INI_Close(FILE);