PDA

View Full Version : why when i connect...


Dziugsas
01/12/2011, 12:29 PM
... i get CJ skin but not skin wich i am selected?


#define VERSIJA "A-V-G 1.0c"
#define DATA "2011-09-01"
#define KODUOTE "Lietuviska"

#include <a_samp>
#include <dini>
#include <dudb>

#include "data/a_samp.inc"
#include "data/global.txt"
#include "data/meta.txt"
#include "data/a_players.inc"
#include "data/a_npc.inc"





#define RED 0xFF0000FF
#define GREY 0xB4B5B7FF
#define ORANGE 0xFF8C00AA
#define GREEN 0x33AA33AA
#define SERIJ 0xB4B5B7FF
#define YELLOW 0xFFFF00AA
#define ZALIA 0x33AA33AA
#define GELTONA 0xFFFF00AA
#define HOMER 0xFF0000AA
#define BLUE 0x33CCFFAA
#define SYNTAX 0xAA3333AA
#define WHITE 0xFFFFFFAA
#define PURPLE 0xC2A2DAAA
#define VIOLET 0x9400D3AA
#define SMELIO 0xF2F3D5AA
#define CORAL 0xFF7F50AA
#define GOLD 0xB8860BAA
#define INDIGO 0x4B00B0AA
#define MAROON 0x800000AA
#define OLIVE 0x808000AA
#define TOMATO 0xFF6347AA
#define MEDIUMAQUA 0x83BFBFAA
#define MEDIUMMAGENTA 0x8B008BAA
#define SYSTEM 0xEFEFF7AA
#define LIME 0x10F441AA
#define MAGENTA 0xFF00FFFF
#define NAVY 0x000080AA
#define AQUA 0xF0F8FFAA
#define CRIMSON 0xDC143CAA
#define FLBLUE 0x6495EDAA
#define BISQUE 0xFFE4C4AA
#define BLACK 0x000000AA
#define PINK 0xFFC0CBAA
#define FARAS 0x004E5BFF
#define PRED 0x9B0000FF
#define COLOR_HPBAR_BG 0x000000FF
#define COLOR_HPBAR_75100BG 0x128200AA
#define COLOR_HPBAR_75100 0x1ED500FF
#define COLOR_HPBAR_5075BG 0xB8BA00AA
#define COLOR_HPBAR_5075 0xFCFF00FF
#define COLOR_HPBAR_2550BG 0xB17103AA
#define COLOR_HPBAR_2550 0xFFA200FF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_GREY 0xAFAFAFFF
#define COLOR_RED 0xAA3333FF
#define COLOR_YELLOW 0xEFF200FF
#define COLOR_GREEN 0x00BA12FF
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_BRIGHTRED 0xDC143CAA
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_GANG 0x98B134FF
#define COLOR_VIOLET 0xAD5BFFFF
#define COLOR_TEAL 0x00FFFFFF
#define COLOR_PURPLE 0x400080FF
#define COLOR_PINK 0xF246A8AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF8000FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define TEX_HOUSE 0x9EEC8EFF

enum pInfo
{
lytis,
skin,
pAdminLevel,
pCash,
pScore
}

new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];

#define SERVER_USER_FILE "vartotojai/%s.ini"

public OnGameModeInit()
{
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{

gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{ff0033}Serverio Registracija", "{0099ff}Sveiki Prasome Ivesti Slaptazodi Kuri Naudosite Prisijungimui", "Registruotis", "Atsaukti");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{ff0033}Serverio Prisijungimas", "{0099ff}Sveiki Prasome Prisijungti", "Prisijungti", "Atsaukti");
}

return 1;
}

public OnPlayerDisconnect(playerid, reason)
{

new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Xp", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Pinigai", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "Adminas",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file,"Lytis",PlayerInfo[playerid][lytis]);
dini_IntSet(file,"Skinas",PlayerInfo[playerid][skin]);

}
gPlayerLogged[playerid] = 0;

return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{ff0033}Serverio Registracija", "{0099ff}Prasome Ivesti Slaptazodi Kuri Naudosite Prisijungimui", "Registruotis", "Atsaukti");
dini_Create(file);
dini_IntSet(file, "Slaptazodis", udb_hash(inputtext));
dini_IntSet(file, "Adminas",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Pinigai",PlayerInfo[playerid][pCash] = 50000);
dini_IntSet(file, "Xp",PlayerInfo[playerid][pScore] = 500);
dini_IntSet(file,"Lytis",PlayerInfo[playerid][lytis]);
dini_IntSet(file,"Skinas",PlayerInfo[playerid][skin]);



format(string, 128, "A-V-G{0099ff}: Tu uzsiregistravai {ff0033}%s {0099ff}tavo slaptazodis {ff0033}%s", name, inputtext);
SendClientMessage(playerid, RED, string);
gPlayerLogged[playerid] = 1;
ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX," Lytis "," Pasirinkite lyti","Vyras","Moteris");
SetPlayerScore(playerid,500);
GivePlayerMoney(playerid,50000);
return 1;
}
}
if(dialogid == 2)
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{ff0033}Serverio Prisijungimas", "{0099ff}Sveiki Prasome Prisijungti", "Prisijungti", "Atsaukti");
new tmp;
tmp = dini_Int(file, "Slaptazodis");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid,RED, "Slaptazodis neteisingas!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{ff0033}Serverio Prisijungimas", "{0099ff}Sveiki Prasome Prisijungti","Prisijungti", "Atsaukti");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "Adminas");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Pinigai")-GetPlayerMoney(playerid));
PlayerInfo[playerid][lytis] = dini_Int(file,"Lytis");
SetPlayerSkin(playerid, dini_Int(file,"Skinas")-GetPlayerSkin(playerid));
SendClientMessage(playerid,RED, "Prisijungei! Gero zaidimo");
return 1;
}
}
}
if(dialogid == 10)
{
if(response)
{
SendClientMessage(playerid,RED,"Jusu Lytis : {0099ff}Vyriska");
PlayerInfo[playerid][lytis]=1;
PlayerInfo[playerid][skin]=188;
SetPlayerSkin(playerid,188);
return 1;
}
if(!response)
{
SendClientMessage(playerid,RED,"Jusu Lytis : {0099ff}Moteriska");
PlayerInfo[playerid][lytis]=0;
PlayerInfo[playerid][skin]=150;
SetPlayerSkin(playerid,150);
return 1;
}
}
return 1;
}

Kaperstone
01/12/2011, 12:32 PM
put under "OnPlayerSpawn" your "SetPlayerSkin" fuction:
SetPlayerSkin(playerid,skinid);
the skin ids can be found here: http://wiki.sa-mp.com/wiki/Skins:All

-CaRRoT
01/12/2011, 12:35 PM
public OnGameModeInit()
{
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

Change that 0 to the Skin ID you want (The First Zero After AddPlayerClass)

Dziugsas
01/12/2011, 12:38 PM
It will make a bugs because its real life.