Folgendes;
Wollte eine Skin Auswahl schreiben, diese funktioniert aber nicht. Der Spieler steht dort immer mit CJ Skin, obwohl dieser nicht definiert.
Hier mal der gesamte Code; (Zudem funktioniert auch das gesamte KeyStateChange Public nicht?)
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_RIGHT))
{
if(pSkinAuswahl[playerid] == 1)
{
for( new i = 0; i < SERVER_MAX_SKIN; i++)
{
new CurPos = ( pSkinID[playerid]+i ) >= SERVER_MAX_SKIN ? ( pSkinID[playerid]+i-SERVER_MAX_SKIN ) : ( pSkinID[playerid]+i );
if(SkinData[CurPos][eSkinGeschlecht] == PlayerData[playerid][eGeschlecht] && SkinData[CurPos][eSkinFrak] == PlayerData[playerid][eFraktion])
{
if(SkinData[CurPos][eIDS] == pSkin[playerid])continue;
pSkinID[playerid] = CurPos;
SetPlayerSkin(playerid, SkinData[CurPos][eIDS]);
pSkin[playerid] = SkinData[CurPos][eIDS];
break;
}
}
}
}
if(PRESSED(KEY_LEFT))
{
if(pSkinAuswahl[playerid] == 1)
{
for( new i = 0; i < SERVER_MAX_SKIN; i++)
{
new CurPos = ( pSkinID[playerid]-i ) < 0 ? ( pSkinID[playerid]-i+SERVER_MAX_SKIN ) : ( pSkinID[playerid]-i );
if(SkinData[CurPos][eSkinGeschlecht] == PlayerData[playerid][eGeschlecht] && SkinData[CurPos][eSkinFrak] == PlayerData[playerid][eFraktion])
{
if(SkinData[CurPos][eIDS] == pSkin[playerid])continue;
pSkinID[playerid] = CurPos;
SetPlayerSkin(playerid, SkinData[CurPos][eIDS]);
pSkin[playerid] = SkinData[CurPos][eIDS];
break;
}
}
}
}
if(PRESSED(KEY_FIRE))
{
if(pSkinAuswahl[playerid] == 1)
{
SetPlayerSkin(playerid, pSkin[playerid]);
PlayerData[playerid][eSkin] = pSkin[playerid];
SpawnPlayer(playerid);
}
}
return 1;
}
case DIALOG_GESCHLECHT:
{
if(!response)return Kick(playerid);
switch(listitem)
{
case 0: //Männlich
{
PlayerData[playerid][eGeschlecht] = 1;
pSkinAuswahl[playerid] = 1;
for(new xS=0;xS<SERVER_MAX_SKIN;xS++)
{
if(SkinData[xS][eSkinGeschlecht] == PlayerData[playerid][eGeschlecht])
{
pSkin[playerid] = SkinData[xS][eIDS];
pSkinID[playerid] = xS;
SetPlayerSkin(playerid, pSkin[playerid]);
break;
}
}
TogglePlayerSpectating(playerid, 0);
TogglePlayerControllable(playerid, 0);
SetPlayerCameraPos(playerid, 442.5763,-1754.9786,9.4103);
SetPlayerCameraLookAt(playerid, 438.7863,-1750.7356,8.8875);
SetPlayerPos(playerid, 438.7863,-1750.7356,8.8875);
SetPlayerFacingAngle(playerid, 221.7693);
SetPlayerInterior(playerid, 0);
ClearChat(playerid, 20);
SendClientMessage(playerid, COLOR_SERVER, "SERVER"HTML_WHITE": Du kannst dir nun mit den Pfeiltasten '<-' - '->' einen Skin wählen.");
SendClientMessage(playerid, COLOR_SERVER, "SERVER"HTML_WHITE": Deine Auswahl kannst Du dann mit 'Enter' bestätigen.");
}
case 1: //Weiblich
{
PlayerData[playerid][eGeschlecht] = 2;
pSkinAuswahl[playerid] = 1;
for(new xS=0;xS<SERVER_MAX_SKIN;xS++)
{
if(SkinData[xS][eSkinGeschlecht] == PlayerData[playerid][eGeschlecht])
{
pSkin[playerid] = SkinData[xS][eIDS];
pSkinID[playerid] = xS;
SetPlayerSkin(playerid, pSkin[playerid]);
break;
}
}
TogglePlayerSpectating(playerid, 0);
TogglePlayerControllable(playerid, 0);
SetPlayerCameraPos(playerid, 442.5763,-1754.9786,9.4103);
SetPlayerCameraLookAt(playerid, 438.7863,-1750.7356,8.8875);
SetPlayerPos(playerid, 438.7863,-1750.7356,8.8875);
SetPlayerFacingAngle(playerid, 221.7693);
SetPlayerInterior(playerid, 0);
ClearChat(playerid, 20);
SendClientMessage(playerid, COLOR_SERVER, "SERVER"HTML_WHITE": Du kannst dir nun mit den Pfeiltasten '<-' - '->' einen Skin wählen.");
SendClientMessage(playerid, COLOR_SERVER, "SERVER"HTML_WHITE": Deine Auswahl kannst Du dann mit 'Enter' bestätigen.");
}
}
}
enum SkinEnum //Skin Auswahl Enum
{
eIDS,
eSkinGeschlecht,
eSkinFrak
}
new SkinData[SERVER_MAX_SKIN][SkinEnum] =
{
// Männlich, Zivilist
{1,1,0}, {2,1,0}, {3,1,0}, {4,1,0}, {5,1,0}, {6,1,0}, {7,1,0}, {14,1,0},
{15,1,0}, {18,1,0}, {20,1,0}, {21,1,0}, {22,1,0}, {23,1,0}, {24,1,0}, {25,1,0},
{26,1,0}, {28,1,0}, {29,1,0}, {32,1,0}, {33,1,0}, {34,1,0}, {35,1,0}, {36,1,0},
{37,1,0}, {44,1,0}, {45,1,0}, {58,1,0}, {60,1,0}, {66,1,0}, {67,1,0},
{68,1,0}, {72,1,0}, {73,1,0}, {78,1,0}, {79,1,0}, {80,1,0}, {81,1,0}, {82,1,0},
{83,1,0}, {84,1,0}, {94,1,0}, {95,1,0}, {96,1,0}, {97,1,0}, {101,1,0}, {132,1,0},
{133,1,0}, {134,1,0}, {135,1,0}, {136,1,0}, {137,1,0}, {154,1,0}, {156,1,0}, {159,1,0},
{160,1,0}, {161,1,0}, {168,1,0}, {170,1,0}, {179,1,0}, {180,1,0}, {182,1,0}, {183,1,0}, {184,1,0},
{185,1,0}, {188,1,0}, {200,1,0}, {202,1,0}, {206,1,0}, {210,1,0}, {212,1,0}, {213,1,0}, {217,1,0},
{234,1,0}, {235,1,0}, {236,1,0}, {239,1,0}, {241,1,0}, {242,1,0}, {249,1,0}, {250,1,0}, {258,1,0}, {259,1,0},
{261,1,0}, {262,1,0}, {264,1,0}, {291,1,0}, {296,1,0}, {297,1,0}, {299,1,0},
// Weiblich, Zivilist
{9,2,0}, {10,2,0}, {12,2,0}, {38,2,0}, {39,2,0}, {41,2,0}, {53,2,0}, {54,2,0}, {55,2,0}, {56,2,0}, {63,2,0},
{64,2,0}, {75,2,0}, {76,2,0}, {77,2,0}, {87,2,0}, {88,2,0}, {89,2,0}, {90,2,0}
};