Problem Spawn and SKin
#1

Hallo,I dont have a good english i hope to understand me..

In gamemode I set a skin to give me when I enter the server, and they set me totally and completely different to random skin, And when I give a faction leader can I respawn .. etc, but if I relog server gives me the civilian spawn and another skin, i hope guys do u understand ..


Код:
public SetPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pChar] > 0)
   	{
		SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
   	}
   	else
   	{
		SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
   	}
    if (PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0) // Civilian
	{
		SetPlayerToTeamColor(playerid);
		SetPlayerPos(playerid,1676.3601,1447.9318,10.7847);
	}
    if (PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) // LVPD
	{
		SetPlayerToTeamColor(playerid);
		SetPlayerPos(playerid,2282.0359,2424.6941,3.4766);
		if(PlayerInfo[playerid][pWeaponLic] == 1)
   		{
			GivePlayerWeaponEx(playerid, 3, 1);
			GivePlayerWeaponEx(playerid, 24, 600);
			GivePlayerWeaponEx(playerid, 29, 2500);
			GivePlayerWeaponEx(playerid, 31, 2500);
			GivePlayerWeaponEx(playerid, 33, 100);
			GivePlayerWeaponEx(playerid, 41, 99999);
		}
   		return 1;
	}
	if (PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) // Mayor
	{
		SetPlayerToTeamColor(playerid);
		SetPlayerPos(playerid,2445.5935,2375.9329,12.1635);
		if(PlayerInfo[playerid][pWeaponLic] == 1)
   		{
			GivePlayerWeaponEx(playerid, 15, 1);
		}
   		return 1;
	}
	if (PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) // Jamaican Posse
	{
		SetPlayerToTeamColor(playerid);
		SetPlayerPos(playerid,2628.3152,2348.8054,10.8203);
		if(PlayerInfo[playerid][pWeaponLic] == 1)
   		{
			GivePlayerWeaponEx(playerid, 24, 250);
		}
   		return 1;
	}
	if (PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) // Mara Salvatrucha
	{
		SetPlayerToTeamColor(playerid);
		SetPlayerPos(playerid,2481.2947,1525.3074,11.7737);
		if(PlayerInfo[playerid][pWeaponLic] == 1)
   		{
			GivePlayerWeaponEx(playerid, 24, 250);
		}
   		return 1;
	}
	if (PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5) // Los Zetas
	{
		SetPlayerToTeamColor(playerid);
		SetPlayerPos(playerid,1456.7838,2773.3408,10.8203);
		if(PlayerInfo[playerid][pWeaponLic] == 1)
   		{
			GivePlayerWeaponEx(playerid, 24, 250);
		}
   		return 1;
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColor(playerid);
    SetPlayerSpawn(playerid);
    gTeam[playerid] = PlayerInfo[playerid][pTeam];
    if(IsPlayerConnected(playerid))
	{
	    if(gLogged[playerid] == 0)
		{
	    	KickWithMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
	 	}
	    if(PlayerInfo[playerid][pTutorial] == 0)
	    {
	        SetPlayerCameraPos(playerid, 1707.5901,1450.7365,10.8175);
			SetPlayerCameraLookAt(playerid, 1707.5901,1450.7365,10.8175);
			SetPlayerPos(playerid, 1676.3601,1447.9318,10.7847);

			ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "Character Gender", "Are you a male or a female?", "Male", "Female");
		}
	}
	return 1;
}



public WhenPlayerLogin(playerid)
{
    if(IsPlayerConnected(playerid))
	{
	    new rows, fields;
	    new tmp[128];
	    new string[256];
	    new pName[30];
		GetPlayerName(playerid, pName, sizeof(pName));

	    cache_get_data(rows, fields, handle);

		if(rows != 0)
		{
		    cache_get_field_content(0, "password", tmp),  format(PlayerInfo[playerid][pPassword], 128, tmp);
			cache_get_field_content(0, "Level", tmp), PlayerInfo[playerid][pLevel] = strval(tmp);
			cache_get_field_content(0, "AdminLevel", tmp), PlayerInfo[playerid][pAdmin] = strval(tmp);
			cache_get_field_content(0, "HelperLevel", tmp), PlayerInfo[playerid][pHelper] = strval(tmp);
			cache_get_field_content(0, "Cash", tmp), PlayerInfo[playerid][pCash] = strval(tmp);
			cache_get_field_content(0, "Account", tmp), PlayerInfo[playerid][pAccount] = strval(tmp);
			cache_get_field_content(0, "Email", tmp),  format(PlayerInfo[playerid][pEmail], 256, tmp);
			cache_get_field_content(0, "Registred", tmp), PlayerInfo[playerid][pRegistred] = strval(tmp);
			cache_get_field_content(0, "Tutorial", tmp), PlayerInfo[playerid][pTutorial] = strval(tmp);
			cache_get_field_content(0, "Sex", tmp), PlayerInfo[playerid][pSex] = strval(tmp);
			cache_get_field_content(0, "Age", tmp), PlayerInfo[playerid][pAge] = strval(tmp);
			cache_get_field_content(0, "PhoneNumber", tmp), PlayerInfo[playerid][pPhoneNumber] = strval(tmp);
			cache_get_field_content(0, "PremiumAccount", tmp), PlayerInfo[playerid][pPremiumAccount] = strval(tmp);
			cache_get_field_content(0, "DrivingLic", tmp), PlayerInfo[playerid][pDrivingLic] = strval(tmp);
			cache_get_field_content(0, "FlyingLic", tmp), PlayerInfo[playerid][pFlyingLic] = strval(tmp);
			cache_get_field_content(0, "BoatLic", tmp), PlayerInfo[playerid][pBoatLic] = strval(tmp);
			cache_get_field_content(0, "WeaponLic", tmp), PlayerInfo[playerid][pWeaponLic] = strval(tmp);
			cache_get_field_content(0, "Team", tmp), PlayerInfo[playerid][pTeam] = strval(tmp);
			cache_get_field_content(0, "Model", tmp), PlayerInfo[playerid][pModel] = strval(tmp);
		}
		else
		{
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "The passwords don't match!\nType your account's password below:", "Login", "Exit");
	        return 1;
		}

		if(PlayerInfo[playerid][pRegistred] == 0)
		{
            PlayerInfo[playerid][pLevel] = 1;
            Update(playerid, pLevelx);
            
            PlayerInfo[playerid][pAdmin] = 0;
            Update(playerid, pAdminx);
            
            PlayerInfo[playerid][pHelper] = 0;
            Update(playerid, pHelperx);
            
            GivePlayerCash(playerid, 2500);
            PlayerInfo[playerid][pAccount] = 2500;
            Update(playerid, pAccountx);
            
            PlayerInfo[playerid][pRegistred] = 1;
			Update(playerid, pRegistredx);
			
			PlayerInfo[playerid][pDrivingLic] = 0;
			PlayerInfo[playerid][pFlyingLic]  = 0;
			PlayerInfo[playerid][pBoatLic]    = 0;
			PlayerInfo[playerid][pWeaponLic]  = 0;
			Update(playerid, pDrivingLicx);
			Update(playerid, pFlyingLicx);
			Update(playerid, pBoatLicx);
			Update(playerid, pWeaponLicx);
			
			new randomphonenumber = 1000000 + random(9999999);
			PlayerInfo[playerid][pPhoneNumber] = randomphonenumber;
			Update(playerid, pPhoneNumberx);
			if(PlayerInfo[playerid][pSex] == 1) // baiet
			{
			    PlayerInfo[playerid][pChar] = 119;
			    PlayerInfo[playerid][pModel] = 119;
				SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
				SetPlayerSkin(playerid, 119);
   			}
			else if(PlayerInfo[playerid][pSex] == 2) // femeie
			{
			    PlayerInfo[playerid][pChar] = 91;
			    PlayerInfo[playerid][pModel] = 91;
				SetPlayerSkin(playerid, 91);
			}
  		}

        GetPlayerCash(playerid);
		SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  		SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
		SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], 1676.3601,1447.9318,10.7847, 1.0, -1, -1, -1, -1, -1, -1);
		SpawnPlayer(playerid);
		
		Update(playerid, pLastLoginx);


		if (PlayerInfo[playerid][pAdmin] >= 1)
		{
			format(string, sizeof(string), "You're logged in as a level %d admin.", PlayerInfo[playerid][pAdmin]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
		}
		
		if (PlayerInfo[playerid][pHelper] >= 1)
		{
			format(string, sizeof(string), "You're logged in as a level %d helper.", PlayerInfo[playerid][pHelper]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
		}
		
		if (PlayerInfo[playerid][pPremiumAccount] >= 1)
		{
			SendClientMessage(playerid, COLOR_WHITE,"You're a premium account user. ");
		}
		
		printf("%s has logged in.", pName);
		gLogged[playerid] = 1;
	}
	return 1;
}
Reply
#2

UP...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)