/setskin
#1

Excuse me guys im new in this lenguage of pawn and im trying to make a /setskin command but i dont knwo how you save the skins on any user, i already have defined "pSkin" this is my code:

PHP Code:
CMD:setskin(playeridparams[])
{
    new 
useridskinid;
    if (
sscanf(params"ui"useridskinid))
        return 
SendClientMessage(playeridCOLOR_GRAD"USAGE: /setskin [Playerid/PartOfName] [Skin ID]");
    if (!
IsPlayerConnected(userid))
        return 
SendClientMessage(playeridCOLOR_GRAD"That player is Offline!");
    if (!(
<= skinid <= 311))
        return 
SendClientMessage(playeridCOLOR_GRAD"Skin can't be below 0 or above 311");
    
    
SetPlayerSkin(useridskinid);
    return 
1;

can you help me please.thank you in advance
Reply
#2

Simple, when you are changing the player skin, just also save it to the playerdata like:
PHP Code:
CMD:setskin(playeridparams[]) 

    new 
useridskinid
    if (
sscanf(params"ui"useridskinid)) 
        return 
SendClientMessage(playeridCOLOR_GRAD"USAGE: /setskin [Playerid/PartOfName] [Skin ID]"); 
    if (!
IsPlayerConnected(userid)) 
        return 
SendClientMessage(playeridCOLOR_GRAD"That player is Offline!"); 
    if (!(
<= skinid <= 311)) 
        return 
SendClientMessage(playeridCOLOR_GRAD"Skin can't be below 0 or above 311"); 
     
    
SetPlayerSkin(useridskinid); 
    
PlayerData[userid][pSkin] = skinid//here just save the skinid to the pskin player enum and save the player data when they are disconnecting, i mean OnPlayerDisonnect. And when the player connect and spawn set the player skin as
// SetPlayerSkin(playerid, PlayerData[userid][pSkin]);
    
return 1

Reply
#3

Code:
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : error 017: undefined symbol "PlayerData"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : error 001: expected token: ";", but found "]"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Quote:
Originally Posted by Jaua10
View Post
Code:
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : error 017: undefined symbol "PlayerData"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : error 001: expected token: ";", but found "]"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\gta-rp\gamemodes\GTARP.pwn(1402) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Edit the PlayerData to your variable's name, pInfo, pStats or whatever.
Reply
#5

This issue has been solved here: https://sampforum.blast.hk/showthread.php?tid=642187 it seems the OP made a new thread about the same issue instead...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)