[SAVESKIN] Saving Skins
#1

Im stuck on how to save skins on death.. say as if i /setskin. or if they purcchase a skin. im wanting so if they die, they keep the same skin. plus when they quit. THANKS <3

Ive been searching for ages.. before you say "Use ******"
Reply
#2

just use a save system like you save player stats and score make a same veriable with name skinid then just use

PHP код:
// remember first save his skin under your setskin cmd or purchase cmd then set skin in onplayerspawn

public OnPlayerSpawn(playerid)
{
   
SetPlayerSkin(playeridpInfo[playerid][SkinID]);
   return 
1;

Reply
#3

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
just use a save system like you save player stats and score make a same veriable with name skinid then just use

PHP код:
// remember first save his skin under your setskin cmd or purchase cmd then set skin in onplayerspawn
public OnPlayerSpawn(playerid)
{
   
SetPlayerSkin(playeridpInfo[playerid][SkinID]);
   return 
1;

How do i save it on the CMD?
Reply
#4

like this

PHP код:

CMD
:skin(playeridparams[])
{
    new 
skinid// we defined veriable of skinid
    
if(sscanf(params"i",skinid)) return SendClientMessage(playerid0xff0000ff,"Usage: /skin <id>");
    if(
skinid 299 || skinid 0) return SendClientMessage(playerid 0xff0000ff"Use vaild skin id from 0 to 299")
    
SetPlayerSkin(playeridskinid); // this will set player skin id and skinid is the veriable of id of skin he try to use
    
format(strsizeof(str), "You have successfully changed your skin id to %d",skinid);// this is format that will be printed to use 
    
SendClientMessage(playerid0xff0000ff,str);
    
pInfo[playerid][SkinID] = skinid// so now skinid is saved in pInfo[playerid][SkinID]
    
return 1;

Reply
#5

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
like this

PHP код:

CMD
:skin(playeridparams[])
{
     new 
skinid// we defined veriable of skinid
    
if(sscanf(params"i",skinid)) return SendClientMessage(playerid0xff0000ff,"Usage: /skin <id>");
    if(
skinid 299 || skinid 0) return SendClientMessage(playerid 0xff0000ff"Use vaild skin id from 0 to 299")
    
SetPlayerSkin(playeridskinid); // this will set player skin id and skinid is the veriable of id of skin he try to use
    
format(strsizeof(str), "You have successfully changed your skin id to %d",skinid);// this is format that will be printed to use 
    
SendClientMessage(playerid0xff0000ff,str);
    
pInfo[playerid][SkinID] = skinid// so now skinid is saved in pInfo[playerid][SkinID]
    
return 1;

I dont have pSkin
Reply
#6

what you mean you dont have pskin ? can you exectly explain ?
Reply
#7

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
what you mean you dont have pskin ? can you exectly explain ?
Can you add the save bit too this...

Код:
CMD:setskin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new
		  targetid,
		  skinid;

		if (!sscanf(params, "ii", targetid, skinid))
		{
		  if (targetid != INVALID_PLAYER_ID)
		  {
		  
		    new
		      message[256];
		    SetPlayerSkin(targetid, skinid);
  	 	    SendClientMessage(playerid, COLOR_WHITE, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
		    format(message, sizeof(message), "Your skin ID was set to '%d' by an Admin!", skinid);
		    SendClientMessage(targetid, COLOR_ORANGE, message);
  		    SendClientMessage(playerid, COLOR_WHITE, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
		  }
		  else SendClientMessage(playerid, COLOR_GREY, "That player is not connected!");
		}
		else SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /setskin [playerid]");
	}
	else SendClientMessage(playerid, COLOR_GREY, "You are not a level 1+ Admin!");
	return 1;
}
Reply
#8

simple just add this line
PHP код:
PlayerInfo[targetid][pSkinID] = skinid
under
PHP код:
 SendClientMessage(playeridCOLOR_WHITE,"~~~~~~~~~~~~~~~~~~~"); 
here your command

PHP код:
CMD:setskin(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new
          
targetid,
          
skinid;
        if (!
sscanf(params"ii"targetidskinid))
        {
          if (
targetid != INVALID_PLAYER_ID)
          {
          
            new
              
message[256];
            
SetPlayerSkin(targetidskinid);
               
SendClientMessage(playeridCOLOR_WHITE"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            
format(messagesizeof(message), "Your skin ID was set to '%d' by an Admin!"skinid);
            
SendClientMessage(targetidCOLOR_ORANGEmessage);
              
SendClientMessage(playeridCOLOR_WHITE"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
              
PlayerInfo[targetid][pSkinID] = skinid;
          }
          else 
SendClientMessage(playeridCOLOR_GREY"That player is not connected!");
        }
        else 
SendClientMessage(playeridCOLOR_WHITE"SYNTAX: /setskin [playerid]");
    }
    else 
SendClientMessage(playeridCOLOR_GREY"You are not a level 1+ Admin!");
    return 
1;

Reply
#9

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
simple just add this line
PHP код:
PlayerInfo[targetid][pSkinID] = skinid
under
PHP код:
 SendClientMessage(playeridCOLOR_WHITE,"~~~~~~~~~~~~~~~~~~~"); 
here your command

PHP код:
CMD:setskin(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new
          
targetid,
          
skinid;
        if (!
sscanf(params"ii"targetidskinid))
        {
          if (
targetid != INVALID_PLAYER_ID)
          {
          
            new
              
message[256];
            
SetPlayerSkin(targetidskinid);
               
SendClientMessage(playeridCOLOR_WHITE"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            
format(messagesizeof(message), "Your skin ID was set to '%d' by an Admin!"skinid);
            
SendClientMessage(targetidCOLOR_ORANGEmessage);
              
SendClientMessage(playeridCOLOR_WHITE"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
              
PlayerInfo[targetid][pSkinID] = skinid;
          }
          else 
SendClientMessage(playeridCOLOR_GREY"That player is not connected!");
        }
        else 
SendClientMessage(playeridCOLOR_WHITE"SYNTAX: /setskin [playerid]");
    }
    else 
SendClientMessage(playeridCOLOR_GREY"You are not a level 1+ Admin!");
    return 
1;

Код:
C:\Users\Luke\Desktop\SCRIPT\gamemodes\SBRP.pwn(1118) : error 017: undefined symbol "pSkinID"
Reply
#10

you need to define that veriable you have enum PINFO or playerinfo under that where pAdmin is defined same as that define pSkinID
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)