Set Player Skin
#1

I would like to know how do i set the player skin at player spawn, i tryed with:

Quote:

SetPlayerSkin(playerid, 277);

but nothing, here is the code:

Quote:

public OnPlayerSpawn(playerid)
{
// Anti F4 Bug - Logging/Registering
if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
{
if(IsPlayerNPC(playerid)) return 1;
SetPlayerPos(playerid, 1975.203002, 3779.311523, -50.243506);
SetPlayerCameraPos(playerid, 1975.203002, 3779.311523, 100.243506);
SetPlayerCameraLookAt(playerid, 1975.203002, 3779.311523, -0.243506);
SetSpawnInfo(playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
SetPlayerSkin(playerid, 29);
new file[64];
format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
// Player isn't banned
if(dini_Int(file, "AdminAccount") == 1)
{
format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
SetPlayerName(playerid, dini_Get(file, "OldName"));
format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
ShowDialog(playerid, 2);
}
if(!dini_Exists(file))
{
ShowDialog(playerid, 1);
return 1;
}
else
{
ShowDialog(playerid, 2);
}
return 1;
}
// Actual Spawning
ResetPlayerWeapons(playerid);
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "BusDriver", true)) //Checking if the NPC's name is BusDriver
{
PutPlayerInVehicle(playerid, NPCBus, 0); //Putting the NPC into the vehicle we created for it.
return 1;
}
return 1;
}
if(PlayerInfo[playerid][pLoggedIn] && PlayerInfo[playerid][pSpawn])
{
FalseBan[playerid] = 0;
SetTimerEx("FalseBanFix", 6000, false, "i", playerid);
SpawnChar(playerid);
}
return 1;
}

Reply
#2

try this
Quote:

CMDetskin(playerid, params[])
{
new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, -1, "USAGE: /setskin [playerid] [skinid]");
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
GetPlayerName(id, targetname, MAX_PLAYER_NAME);
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player not connected!");
if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, 0xFF0000, "Invalid skin id. (Available skinid's 0-299)");
SetPlayerSkin(id, skinid);
format(string, 128, "RCON Admin %s(%d) has set your skinid to %i", name, playerid, skinid);
SendClientMessage(id, -1, string);
format(string, 128, "You set %s(%d) skin to skinid %i", targetname, id, skinid);
SendClientMessage(playerid, -1, string);
return 1;
}

maybe works I Copy this from someone he need an REP not me this is an /setskin cmd
this one the top
Quote:

#include <foreach>
#include <sscanf2>

only Ron can do this
Reply
#3

if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))

that is saying if PlayerInfo[playerid][pLoggedIn] == 0, to continue, else if that equals 1, it will not do anything under those brackets (where it's supposed to change the skin), change

if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))

to

if(PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
Reply
#4

Quote:
Originally Posted by DeathTone
Посмотреть сообщение
if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))

that is saying if PlayerInfo[playerid][pLoggedIn] == 0, to continue, else if that equals 1, it will not do anything under those brackets (where it's supposed to change the skin), change

if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))

to

if(PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
Tryed this but doing it i'll never get into the game cause it redirect me always into login.
Reply
#5

OMG IT'S SO SIMPLY!
Код:
public OnPlayerSpawn(playerid)
{
        if(IsPlayerNPC(playerid)) return 1;
        SetPlayerSkin(playerid, 277);
        return 1;
}
where is the problem?
Reply
#6

https://sampwiki.blast.hk/wiki/SetPlayerSkin
https://sampwiki.blast.hk/wiki/GetPlayerSkin
https://sampwiki.blast.hk/wiki/SetSpawnInfo
Reply
#7

Quote:
Originally Posted by Mustafa6155
Посмотреть сообщение
only Ron can do this
LOL Ron?

OT: its not on PlayerConnect cause they haven't spawned yet, so it goes in "OnPlayerSpawn"
Reply
#8

It doesn't work, any other suggestions?
Reply
#9

again, try this!
Код:
public OnPlayerSpawn(playerid)
{
        if(IsPlayerNPC(playerid)) return 1;
        SetPlayerSkin(playerid, 277);
        return 1;
}
Reply
#10

Look at this:

pawn Код:
public OnPlayerSpawn(playerid)
{
    // Anti F4 Bug - Logging/Registering
    if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
    {
        if(IsPlayerNPC(playerid)) return 1;
        SetPlayerSkin(playerid, 29);
        SetPlayerPos(playerid, 1975.203002, 3779.311523, -50.243506);
        SetPlayerCameraPos(playerid, 1975.203002, 3779.311523, 100.243506);
        SetPlayerCameraLookAt(playerid, 1975.203002, 3779.311523, -0.243506);
        SetSpawnInfo(playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        new file[64];
        format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
        // Player isn't banned
        if(dini_Int(file, "AdminAccount") == 1)
        {
            format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
            SetPlayerName(playerid, dini_Get(file, "OldName"));
            format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
            ShowDialog(playerid, 2);
        }
        if(!dini_Exists(file))
        {
            ShowDialog(playerid, 1);
            return 1;
        }
        else
        {
            ShowDialog(playerid, 2);
        }
        return 1;
    }
    // Actual Spawning
    ResetPlayerWeapons(playerid);
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
      new npcname[MAX_PLAYER_NAME];
      GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
      if(!strcmp(npcname, "BusDriver", true)) //Checking if the NPC's name is BusDriver
      {
        PutPlayerInVehicle(playerid, NPCBus, 0); //Putting the NPC into the vehicle we created for it.
        return 1;
      }
      return 1;
    }
    if(PlayerInfo[playerid][pLoggedIn] && PlayerInfo[playerid][pSpawn])
    {
        FalseBan[playerid] = 0;
        SetTimerEx("FalseBanFix", 6000, false, "i", playerid);
        SpawnChar(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)