14.05.2012, 09:21
Alright let's work first on cleaning it as I can see you're using pData[playerid][PrivateSkin] = 0; in many conditions while you can use them in one.
Also cleaning a little with else conditions.
+ I've noticed you're using if(pData[playerid][Admin] < 5) for clan owners, maybe you wanna revise that.
Also cleaning a little with else conditions.
+ I've noticed you're using if(pData[playerid][Admin] < 5) for clan owners, maybe you wanna revise that.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2282.3689,-1248.0156,24.0000);
SetPlayerFacingAngle(playerid, 180.6267);
SetPlayerCameraPos(playerid, 2282.2136,-1252.6395,24.0000);
SetPlayerCameraLookAt(playerid, 2282.3689,-1248.0156,24.0000);
if(PlaySong[playerid] == 0)
{
PlaySong[playerid] = 1;
PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3");
}
// Public Classes
if(classid == 22 || classid == 24 || classid == 28 || classid == 30 || classid == 55 || classid == 57 || classid == 207 || classid == 209 || classid == 216 || classid == 218)
{
pData[playerid][PrivateSkin] = 0;
}
// Level 1+ VIP classes
else if(classid == 23)
{
if(pData[playerid][VIP] < 1)
{
SendClientMessage(playerid, COLOR_RED, "*** For VIP only! ***");
GameTextForPlayer(playerid, "~r~For VIP only!", 3000, 4);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
}
pData[playerid][PrivateSkin] = 1;
}
// Level 5+ admin classes
else if(classid == 29 || classid == 56)
{
if(pData[playerid][Admin] < 5)
{
SendClientMessage(playerid, COLOR_RED, "*** For Clan Owner/Co-Owner only! ***");
GameTextForPlayer(playerid, "~r~For Clan Owner/Co-Owner only!", 3000, 4);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
}
pData[playerid][PrivateSkin] = 2;
}
// Level 1+ admin classes
else if(classid == 208 || classid == 217)
{
if(pData[playerid][Admin] < 1)
{
SendClientMessage(playerid, COLOR_RED, "*** For Server Administrators only! ***");
GameTextForPlayer(playerid, "~r~For Server Administrators only!", 3000, 4);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "*** You are allowed to use this skin! ***");
GameTextForPlayer(playerid, "~g~You are allowed to use this skin!", 4000, 4);
}
pData[playerid][PrivateSkin] = 3;
}
return 1;
}