/setskin problem
#9

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=0n<lengthn++)
    {
       
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.506815000CAMERA_MOVE);
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_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.506815000CAMERA_MOVE);
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Scrie o parola pentru a te inregistra.","Register","Quit");
    }
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_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(playerid0xFFFFFFAA);
                
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(playerid0xFFFFFFAA);
                    
SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],1283.5896,-1329.5938,13.3824,89.6460,0,0,0,0,0,0);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
SpawnPlayer(playerid);
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_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(playeridFloat:fXFloat:fYFloat:fZ)
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        
SetPlayerPosFindZ(playeridfXfYfZ);
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    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(playeridkilleridreason)
{
    
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(playeridparams[])
{
    new 
pIDvalue;
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOL_GOLD"Foloseste: /makeadmin [id] [adminlevel]");
    else if(
value || value 6) return SendClientMessage(playeridCOL_GOLD"Nivele valabile: 0-6.");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOL_TOM"Jucatorul nu este conectat.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui %s admin level %i."targetvalue);
        
SendClientMessage(playeridCOL_GYELLOWstring);
        
format(stringsizeof(string), "Nivelul tau de admin a fost setat la %i de %s."valuepName);
        
SendClientMessage(pIDCOL_GYELLOWstring);
        
PlayerInfo[pID][pAdmin] = value;
    }
    return 
1;
}
CMD:setlevel(playeridparams[])
{
    new 
pIDvalue;
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOL_GOLD"Foloseste: /setlevel [id] [level]");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOL_TOM"Jucatorul nu este conectat.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui %s level %i."targetvalue);
        
SendClientMessage(playeridCOL_GYELLOWstring);
        
format(stringsizeof(string), "Nivelul tau a fost setat la %i de %s."valuepName);
        
SendClientMessage(pIDCOL_GYELLOWstring);
        
PlayerInfo[pID][pLevel] = value;
    }
    return 
1;
}
CMD:setskin(playeridparams[])
{
    new 
pIDvalue;
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOL_GOLD"Foloseste: /setskin [id] [skin]");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOL_TOM"Jucatorul nu este conectat.");
    else if(
value || value 311) return SendClientMessage(playeridCOL_GOLD"Skinuri valabile: 0-311.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui %s skin-ul %i."targetvalue);
        
SendClientMessage(playeridCOL_GYELLOWstring);
        
format(stringsizeof(string), "Skinul tau este acum %i datorita lui %s."valuepName);
        
SendClientMessage(pIDCOL_GYELLOWstring);
        
PlayerInfo[pID][pSkin] = value;
        
SetPlayerSkin(pIDPlayerInfo[pID][pSkin]);
    }
    return 
1;

Reply


Messages In This Thread
/setskin problem - by GabiXx - 01.12.2016, 10:33
Re: /setskin problem - by Belengher - 01.12.2016, 10:34
Re: /setskin problem - by F1N4L - 01.12.2016, 10:36
Re: /setskin problem - by GabiXx - 01.12.2016, 10:44
Re: /setskin problem - by BrianFaria - 01.12.2016, 10:46
Re: /setskin problem - by GabiXx - 01.12.2016, 10:52
Re: /setskin problem - by Alpay0098 - 01.12.2016, 10:53
Re: /setskin problem - by BrianFaria - 01.12.2016, 11:00
Re: /setskin problem - by GabiXx - 01.12.2016, 11:12
Re: /setskin problem - by MattMaximum - 08.12.2016, 12:50

Forum Jump:


Users browsing this thread: 2 Guest(s)