SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/12/2016, 10:33 AM   #1
GabiXx
Huge Clucker
 
GabiXx's Avatar
 
Join Date: Aug 2014
Location: Constanta, Romania
Posts: 222
Reputation: 0
Default /setskin problem

i use this
PHP Code:
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;
    }
    return 
1;

When i use it, player get the messages but skin is same, don't change..
EDIT: It's a problem if the player who i want to change skin, is me?
GabiXx is offline   Reply With Quote
Old 01/12/2016, 10:34 AM   #2
Belengher
Huge Clucker
 
Join Date: May 2015
Posts: 199
Reputation: 0
Default Re: /setskin problem

Try this.

HTML Code:
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); 
        SetPlayerSkin(pID, value);
        PlayerInfo[pID][pSkin] = value; 
    } 
    return 1; 
}
Belengher is offline   Reply With Quote
Old 01/12/2016, 10:36 AM   #3
F1N4L
High-roller
 
F1N4L's Avatar
 
Join Date: Jun 2013
Posts: 2,726
Reputation: 260
Default Re: /setskin problem

Add this after PlayerInfo[pID][pSkin]
Code:
SetPlayerSkin(pID, PlayerInfo[pID][pSkin]);
F1N4L is offline   Reply With Quote
Old 01/12/2016, 10:44 AM   #4
GabiXx
Huge Clucker
 
GabiXx's Avatar
 
Join Date: Aug 2014
Location: Constanta, Romania
Posts: 222
Reputation: 0
Default Re: /setskin problem

Now work, but skin are not saved. I have same comand with /setlevel /setadmin and these are saved in users folder
GabiXx is offline   Reply With Quote
Old 01/12/2016, 10:46 AM   #5
BrianFaria
Huge Clucker
 
BrianFaria's Avatar
 
Join Date: Oct 2015
Location: Argentina.
Posts: 423
Reputation: 81
Default Re: /setskin problem

Well, you have to create a skin save.
__________________
[S]peed_.
BrianFaria is offline   Reply With Quote
Old 01/12/2016, 10:52 AM   #6
GabiXx
Huge Clucker
 
GabiXx's Avatar
 
Join Date: Aug 2014
Location: Constanta, Romania
Posts: 222
Reputation: 0
Default Re: /setskin problem

In enum i have pSkin and this
PHP Code:
public OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    ..... 
So..it have to save...
GabiXx is offline   Reply With Quote
Old 01/12/2016, 10:53 AM   #7
Alpay0098
Huge Clucker
 
Alpay0098's Avatar
 
Join Date: Oct 2014
Location: Behind ya :o
Posts: 287
Reputation: 20
Default Re: /setskin problem

Add "SetPlayerSkin(playerid, PlayerInfo[pID][pSkin]);" below the OnPlayerSpawn public func.
It might be the problem
__________________
My works :
  • [FilterScript] Reconnect System Removed due to some reasons. P.M. me if you want it.
Alpay0098 is offline   Reply With Quote
Old 01/12/2016, 11:00 AM   #8
BrianFaria
Huge Clucker
 
BrianFaria's Avatar
 
Join Date: Oct 2015
Location: Argentina.
Posts: 423
Reputation: 81
Default Re: /setskin problem

Add
Code:
new INI:File = INI_Open(UserPath(playerid)); 
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
OnPlayerSpawn
__________________
[S]peed_.
BrianFaria is offline   Reply With Quote
Old 01/12/2016, 11:12 AM   #9
GabiXx
Huge Clucker
 
GabiXx's Avatar
 
Join Date: Aug 2014
Location: Constanta, Romania
Posts: 222
Reputation: 0
Default Re: /setskin problem

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;

GabiXx is offline   Reply With Quote
Old 08/12/2016, 12:50 PM   #10
MattMaximum
Little Clucker
 
Join Date: Feb 2016
Location: Romania, Bucharest
Posts: 16
Reputation: 0
Default Re: /setskin problem

At case dialog login where you have SetSpawnInfo(playerid, 0...); modify SetSpawnInfo(playerid, PlayerInfo[playerid][pSkin]...);
__________________
My creations!

[FILTERSCRIPT] Basic AutoMessage by MattMaximum!
MattMaximum is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple /setskin cmd problem Sturra Scripting Help 10 02/07/2014 08:17 PM
Setskin problem Crazyboobs Scripting Help 4 28/06/2012 06:12 PM
SetSkin problem ttloko2 Scripting Help 4 28/01/2012 02:43 PM
[Help]/setskin help Tamao_Serizawa Scripting Help 8 08/01/2012 11:45 AM
A little problem with /setskin Rivera Help Archive 5 18/03/2011 04:00 PM


All times are GMT. The time now is 07:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.