CMD:setskin(playerid, params[])
{
if(Player[playerid][pAdmin] | Player[playerid][pGM] < 2)
return sendErrorMessage(playerid, MSG_CMD_WITHOUT_PERMISSION);
static skin, id, string[78], str[67];
if(sscanf(params, "dd", id, skin))
return sendErrorMessage(playerid, "/setskin [ID] [ID - SKIN]");
if(id == INVALID_PLAYER_ID)
return sendErrorMessage(playerid, MSG_PLAYER_OFF);
SetPlayerSkin(id, skin);
Player[id][pSkin] = skin;
format(string, sizeof(string),"| ADMIN | O(A) Staffer {FFFFFF}%s{1874CD} setou а skin ID: %d em vocк.", Player[playerid][pName], skin);
SendClientMessage(id, COR_ADMIN, String);
format(str, sizeof(str),"| INFO | Vocк setou skin ID: %d no player %s", skin, Player[id][pName]);
SendClientMessage(playerid, COR_INFO, str);
return 1;
}
loadPlayer(playerid)
{
orm_addvar_int(ormid, Player[playerid][pSkin], "Skin");
}
SetSpawnInfo(playerid, 0, Player[playerid][pSkin], 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
CMD:setskin(playerid, params[])
{
if(Player[playerid][pAdmin] | Player[playerid][pGM] < 2)
return sendErrorMessage(playerid, MSG_CMD_WITHOUT_PERMISSION);
static skin, id, string[78], str[67];
if(sscanf(params, "dd", id, skin))
return sendErrorMessage(playerid, "/setskin [ID] [ID - SKIN]");
if(id == INVALID_PLAYER_ID)
return sendErrorMessage(playerid, MSG_PLAYER_OFF);
SetPlayerSkin(id, skin);
Player[id][pSkin] = skin;
format(string, sizeof(string),"| ADMIN | O(A) Staffer {FFFFFF}%s{1874CD} setou а skin ID: %d em vocк.", Player[playerid][pName], skin);
SendClientMessage(id, COR_ADMIN, String);
format(str, sizeof(str),"| INFO | Vocк setou skin ID: %d no player %s", skin, Player[id][pName]);
SendClientMessage(playerid, COR_INFO, str);
return 1;
}
loadPlayer(playerid)
{
orm_addvar_int(ormid, Player[playerid][pSkin], "Skin");
}
public OnPlayerConnect
{
if(!IsPlayerNPC(playerid))
{
clearPlayerVars(playerid);
loadPlayer(playerid);
SetSpawnInfo(playerid, 0, Player[playerid][pSkin], 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
Player[playerid][pTimerPlayer] = SetTimerEx("OnPlayerUpdateEx", 1000, true, "i", playerid);
}
// Sua variavel
enum pData
{
ORM:OrmID,
// outros dados
pNome[24],
pTimerPlayer,
pSkin
}
new Player[MAX_PLAYERS][pData];
// Sua funзгo
loadPlayer(playerid)
{
new ORM:ormid = Player[playerid][OrmID] = orm_create("suatabela", conexao_mysql);
// Outros que tiverem vocк pхe tambйm
orm_addvar_int(ormid, Player[playerid][pSkin], "Skin");
orm_addvar_string(ormid, Player[playerid][pNome], 24, "Nome"); // nickname
orm_setkey(ormid, 24, "Nome");
orm_select(ormid, "OnPlayerLogin", "d", playerid);
}
// Salvamento de conta
savePlayer(playerid) return orm_update(Player[playerid][OrmID]);
// Quando conectar
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, Player[playerid][pNome], 24);
loadPlayer(playerid);
Player[playerid][pTimerPlayer] = SetTimerEx("OnPlayerUpdateEx", 1000, true, "i", playerid);
}
// Parвmetros para recebimento de informaзхes / login
forward OnPlayerLogin(playerid);
public OnPlayerLogin(playerid)
{
if(orm_errno(PlayerInfo[playerid][OrmID]) == ERROR_OK) { // jogador tem registro no banco de dados
SetSpawnInfo(playerid, 0, Player[playerid][pSkin], 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
SendClientMessage(playerid, 0x00FF00FF, "Vocк estб registrado!");
} else { // Jogador nгo possui registro no banco de dados
SendClientMessage(playerid, 0xFFFF00FF, "Vocк nгo estб registrado!");
SetSpawnInfo(playerid, 0, random(311), 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
}
return 1;
}
SetSpawnInfo sу na hora que o player logar, ai se a skin mesmo assim nгo for sentada, use SetPlayerSkin(playerid, Player[playerid][pSkin]); no OnPlayerSpawn.
|