/saveskin problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /saveskin problem (
/showthread.php?tid=275844)
/saveskin problem -
Millionaire - 11.08.2011
I want to make this /saveskin cmd to normal players.This cmd i taken from ladmin
pawn Код:
CMD:saveskin(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 1 && PlayerInfo[playerid][LoggedIn] == 1) {
if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /saveskin [skinid]");
new string[128], SkinID = strval(params);
if((SkinID == 0)||(SkinID == 7)||(SkinID >= 9 && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299))
{
dUserSetINT(PlayerName2(playerid)).("FavSkin",SkinID);
format(string, sizeof(string), "You have successfully saved this skin (ID %d)",SkinID);
SendClientMessage(playerid,yellow,string);
SendClientMessage(playerid,yellow,"Type: /useskin to use this skin when you spawn or /dontuseskin to stop using skin");
dUserSetINT(PlayerName2(playerid)).("UseSkin",1);
return CMDMessageToAdmins(playerid,"SAVESKIN");
} else return SendClientMessage(playerid, green, "ERROR: Invalid Skin ID");
} else return SendClientMessage(playerid,red,"ERROR: You must be an administrator to use this command");
}
I tryed to make it for normal playersand it didnt showed any errors or warnings.But when i use that command and relog, the skin isnt saved.But if a admin use that cmd then it will save.
I want to make it for normal players, please anyone help me .
Re: /saveskin problem -
XGh0stz - 11.08.2011
Just change this:
Код:
if(PlayerInfo[playerid][Level] >= 1 && PlayerInfo[playerid][LoggedIn] == 1)
To this:
Код:
if(PlayerInfo[playerid][LoggedIn] == 1)
Re: /saveskin problem -
Millionaire - 11.08.2011
yes i did but it isnt working
Re: /saveskin problem -
Admigo - 11.08.2011
try if(PlayerInfo[playerid][Level] >= 1 && PlayerInfo[playerid][LoggedIn] == 1)
to
if(PlayerInfo[playerid][Level] >= 0 && PlayerInfo[playerid][LoggedIn] == 1)
Re: /saveskin problem -
XGh0stz - 11.08.2011
The problem is this then:
PlayerInfo[playerid][LoggedIn] == 1
But without that, any player at all would be able to save thier save then
When you tested, was the player logged in?!
Re: /saveskin problem -
Millionaire - 11.08.2011
Skin is saving in file but when a player spawn , then the player skin wont change to the saved skin
Re: /saveskin problem -
XGh0stz - 11.08.2011
Well in that case you're going to have to check OnPlayerSpawn then
Re: /saveskin problem -
Ironboy - 11.08.2011
Quote:
Originally Posted by XGh0stz
Well in that case you're going to have to check OnPlayerSpawn then
|
Like he said, in onplayerspawn you can see like this
pawn Код:
if((dUserINT(PlayerName2(playerid)).("UseSkin")) == 1)
if((PlayerInfo[playerid][Level] >= 1) && (PlayerInfo[playerid][LoggedIn] == 1))
SetPlayerSkin(playerid,(dUserINT(PlayerName2(playerid)).("FavSkin")) );
Change it to
pawn Код:
if((dUserINT(PlayerName2(playerid)).("UseSkin")) == 1)
if((PlayerInfo[playerid][LoggedIn] == 1))
SetPlayerSkin(playerid,(dUserINT(PlayerName2(playerid)).("FavSkin")) );
Re: /saveskin problem -
Millionaire - 11.08.2011
ok ty very much