01.12.2016, 11:12
I try your codes..same when i disconnect it's other skin. I let this here..maybe you find a mistake from me.
PHP Code:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <YSI\y_ini>
main( ) { }
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COL_GOLD 0xB8860BAA
#define COL_TOM 0xFF6347AA
#define COL_ROSU 0xFF0000FF
#define COL_GYELLOW 0xADFF2FAA
#define PATH "/Users/%s.ini"
enum pInfo
{
pPass,
pLevel,
pCash,
pAdmin,
pSkin,
pKills
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock udb_hash(buf[]) {
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 OnGameModeInit()
{
SetGameModeText("Girvinmode");
DisableInteriorEnterExits();
ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
UsePlayerPedAnims();
AddPlayerClass(170,1283.5896,-1329.5938,13.3824,89.6460,0,0,0,0,0,0);
AddStaticVehicle(405,1280.1495,-1292.5573,13.1545,90.5277,1,1); // Sentinel
AddStaticVehicle(410,1281.3601,-1383.1337,13.1312,90.2541,2,1); // Manana
AddStaticVehicle(426,1281.3218,-1363.8834,13.1479,89.5308,3,96); // Premier
AddStaticVehicle(429,1281.0326,-1312.9939,13.1839,89.4532,4,1); // Banshee
AddStaticVehicle(481,1272.7340,-1321.6632,13.3071,180.5797,5,96); // masina5
AddStaticVehicle(481,1272.6222,-1353.7826,13.3183,359.2056,6,96); // masina6
AddStaticVehicle(462,1282.5690,-1374.6877,12.8680,84.3409,7,0); // scuter
AddStaticVehicle(462,1282.1868,-1304.3948,12.8941,84.6293,8,9); // scuter2
return 1;
}
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
InterpolateCameraPos(playerid,847.8779,-1803.8601,32.1953,544.5193,-1742.0396,32.5068, 15000, CAMERA_MOVE);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Scrie-ti parola pentru a te loga.","Login","Quit");
}
else
{
InterpolateCameraPos(playerid,847.8779,-1803.8601,32.1953,544.5193,-1742.0396,32.5068, 15000, CAMERA_MOVE);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Scrie o parola pentru a te inregistra.","Register","Quit");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registering...",""COL_RED"Ai introdus o parola gresita.\n"COL_WHITE"Scrie o parola pentru a te inregistra.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
GivePlayerMoney(playerid,10000);
SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],1283.5896,-1329.5938,13.3824,89.6460,0,0,0,0,0,0);
SetPlayerColor(playerid, 0xFFFFFFAA);
SpawnPlayer(playerid);
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Kills",0);
INI_Close(File);
}
}
case DIALOG_LOGIN:
{
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GetPlayerSkin(playerid);
SetPlayerColor(playerid, 0xFFFFFFAA);
SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],1283.5896,-1329.5938,13.3824,89.6460,0,0,0,0,0,0);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"Ai introdus o parola gresita.\n"COL_WHITE"Scrie parola mai jos pentru a te loga.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
SetPlayerPosFindZ(playerid, fX, fY, fZ);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
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,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_Close(File);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],1283.5896,-1329.5938,13.3824,89.6460,0,0,0,0,0,0);
return 1;
}
////COMENZI/////////////////////////////////////////////////////////////////////////
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COL_GOLD, "Foloseste: /makeadmin [id] [adminlevel]");
else if(value < 0 || value > 6) return SendClientMessage(playerid, COL_GOLD, "Nivele valabile: 0-6.");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_TOM, "Jucatorul nu este conectat.");
else
{
new string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, target, sizeof(target));
format(string, sizeof(string), "I-ai setat lui %s admin level %i.", target, value);
SendClientMessage(playerid, COL_GYELLOW, string);
format(string, sizeof(string), "Nivelul tau de admin a fost setat la %i de %s.", value, pName);
SendClientMessage(pID, COL_GYELLOW, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}
CMD:setlevel(playerid, params[])
{
new pID, value;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COL_GOLD, "Foloseste: /setlevel [id] [level]");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_TOM, "Jucatorul nu este conectat.");
else
{
new string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, target, sizeof(target));
format(string, sizeof(string), "I-ai setat lui %s level %i.", target, value);
SendClientMessage(playerid, COL_GYELLOW, string);
format(string, sizeof(string), "Nivelul tau a fost setat la %i de %s.", value, pName);
SendClientMessage(pID, COL_GYELLOW, string);
PlayerInfo[pID][pLevel] = value;
}
return 1;
}
CMD:setskin(playerid, params[])
{
new pID, value;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COL_GOLD, "Foloseste: /setskin [id] [skin]");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_TOM, "Jucatorul nu este conectat.");
else if(value < 0 || value > 311) return SendClientMessage(playerid, COL_GOLD, "Skinuri valabile: 0-311.");
else
{
new string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, target, sizeof(target));
format(string, sizeof(string), "I-ai setat lui %s skin-ul %i.", target, value);
SendClientMessage(playerid, COL_GYELLOW, string);
format(string, sizeof(string), "Skinul tau este acum %i datorita lui %s.", value, pName);
SendClientMessage(pID, COL_GYELLOW, string);
PlayerInfo[pID][pSkin] = value;
SetPlayerSkin(pID, PlayerInfo[pID][pSkin]);
}
return 1;
}