Question

Bсем привет, столкнулся с такой проблемой когда на сервере даю лидерку одному игроку, потом делаю рестарт и у всех зарегистрированных аккаунтов появляется та лидерка которая послднию админ выдал игроку перед самым рестаротом, зашел в бд, увидел что не только у меня одного лидерка а у всех аккаунтов. Еще после релога персонажа дается рандомный скин. Помогите пожалуйста, пишите что нужно скинуть какой код.

Edited by Alex William

Share this post


Link to post

12 answers to this question

  • 0

@Alex William, показывайте команду выдачи прав лидера. А насчет одежды... Покажите, наверное, OnPlayerSpawn.

Share this post


Link to post
  • 0

@odosenok,

public OnPlayerSpawn(playerid)
{
    if(!strcmp(PlayerInfo[playerid][pIP],"176.32.39.36"))return 1;
    TextDrawHideForPlayer(playerid, greenzone);
    TextDrawShowForPlayer(playerid, Datum);
    TextDrawShowForPlayer(playerid, Vrijeme);
    if(!PlayerInfo[playerid][pLogin]) return SCM(playerid, COLOR_WHITE, "Необходимо авторизоваться!"), KickEx(playerid, 001);
    if(!IsPlayerConnected(playerid)) return 1;
     AC_SpawnedPlayer[playerid] = true;
     AC_Healthtime[playerid]=3+floatround(GetPlayerPing(playerid)+100/100);
    AC_NoDeath{playerid} = false;
    AC_PlayerToggle{playerid}=true;
    if(GetPVarInt(playerid,"AC_PlayerToggleTime")>0) DeletePVar(playerid,"AC_PlayerToggleTime");
    GetPlayerPos(playerid,PVHFL[playerid][0],PVHFL[playerid][1],PVHFL[playerid][2]);
    AntiFakeGun[playerid] = 0;
    SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,990);
    SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,990);
    SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,990);
    SetPlayerHealthAC(playerid, 100.0);
    SetCameraBehindPlayer(playerid);
    SetPlayerVirtualWorld(playerid,0);
    SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
    DeletePVar(playerid, "K_Times");
    AntiFakeKill[playerid] = true;
    if(!PlayerInfo[playerid][pLogin] && !cheaters{playerid}) return KickEx(playerid, 75);
    SetPlayerColor(playerid, FractionInfo[PlayerInfo[playerid][pMember]][fColor]);
    if(PlayerInfo[playerid][pMember])
    {
        if(StartRabWork(playerid) && !GetPVarInt(playerid,"StartRabWork")) SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
        else SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    }
    if(!PlayerInfo[playerid][pMember]) SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
    if(GetPVarInt(playerid, "gps_pic") == 228) DeletePVar(playerid, "gps_pic"), DisablePlayerCheckpoint(playerid);
    KillTimer(STimer[playerid]);
    if(PlayerInfo[playerid][pAccessories][0] != 0x0) SetPlayerAttachedObject(playerid,0,PlayerInfo[playerid][pAccessories][0],2,PlayerInfo[playerid][PositionAcc][0],PlayerInfo[playerid][PositionAcc][1], PlayerInfo[playerid][PositionAcc][2],PlayerInfo[playerid][PositionAcc][3],PlayerInfo[playerid][PositionAcc][4],PlayerInfo[playerid][PositionAcc][5], PlayerInfo[playerid][PositionAcc][6], PlayerInfo[playerid][PositionAcc][7],PlayerInfo[playerid][PositionAcc][8]);
    if(PlayerInfo[playerid][pAccessories][1] != 0x0) SetPlayerAttachedObject(playerid,1,PlayerInfo[playerid][pAccessories][1],2,0.1, 0.03, 0.0, 0.0, 90.0, 90.0);
    new gun[128];
    GetPVarString(playerid,"mysqlgun",gun,128);
    DeletePVar(playerid,"mysqlgun");
    if(strlen(gun))
    {
        new guns[6],ammos[6],datas[2][56];
        explode(datas,gun,":");
        sscanf(datas[0],"p<|>a<i>[6]",guns);
        sscanf(datas[1],"p<|>a<i>[6]",ammos);
        for(new i;i<6;i++) GivePlayerWeaponAC(playerid,guns,ammos);
    }
    if(PlayerInfo_MP_START{playerid}) return GiveStatus_MP(playerid, GetPVarInt(playerid,"PlayerInfo_MP_Staus"));
    if(GetPVarInt(playerid, "spectate_samp"))
    {
        for(new i=0;i<2;i++) TextDrawShowForPlayer(playerid,AProtectBox);
        for(new i=0;i<14;i++) TextDrawShowForPlayer(playerid,BadAPlayer);
        DeletePVar(playerid, "spectate_samp");
        SetPlayerPos(playerid, GetPVarFloat(playerid, "PosSpecX"), GetPVarFloat(playerid, "PosSpecY"), GetPVarFloat(playerid, "PosSpecZ"));
        SetPlayerInterior(playerid, GetPVarInt(playerid, "SpecInt"));
        SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "SpecVT"));
        return true;
    }
    if(PlayerInfo[playerid][pPrison][0] && PlayerInfo[playerid][pPrison][1])
    {
        SetPlayerVirtualWorld(playerid,1);
        SetPlayerInterior(playerid, 0);
        SetPlayerPosEx(playerid,5512.0884,1243.8398,23.1886);
        SetPlayerFacingAngle(playerid, 179.7971);
        return 1;
    }
    if(PlayerInfo[playerid][pJailed] == 1)
    {
        if(PlayerInfo[playerid][pMestoJail] == 1)
        {
            SetPlayerInterior(playerid, 6);
            SetPlayerPosEx(playerid,264.1425,77.4712,1001.0391);
            SetPlayerFacingAngle(playerid, 263.0160);
            return 1;
        }
        if(PlayerInfo[playerid][pMestoJail] == 2)
        {
            SetPlayerInterior(playerid, 10);
            SetPlayerPosEx(playerid,219.5400,109.9767,999.0156);
            SetPlayerFacingAngle(playerid, 1.0000);
            return 1;
        }
        if(PlayerInfo[playerid][pMestoJail] == 3)
        {
            SetPlayerInterior(playerid, 3);
            SetPlayerPosEx(playerid,198.3642,161.8103,1003.0300);
            SetPlayerFacingAngle(playerid, 1.0000);
            return 1;
        }
    }
    else if(PlayerInfo[playerid][pJailed] == 4)
    {
        SetPlayerInterior(playerid, 0);
        SetPlayerPosEx(playerid,5508.3706,1244.7594,23.1886);
        SetPlayerSkin(playerid, 62);
        return 1;
    }
    if(PlayerInfo[playerid][pHospital])
    {
        TogglePlayerControllable(playerid, false);
        SetTimerEx("UnFreez", 3000, 0, "d", playerid);
        new randomspawn = RandomEx(0,2);
        SetPlayerPosEx(playerid, SpawnAmbulance[randomspawn][0], SpawnAmbulance[randomspawn][1], SpawnAmbulance[randomspawn][2]);
        pTemp[playerid][pInHospital] = true;
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        SetPlayerHealthAC(playerid, 10.0);
        return 1;
    }
    if((PlayerInfo[playerid][pHouse] != -1 || PlayerInfo[playerid][pArendaHouse] != -1) && PlayerInfo[playerid][pSpawn] == 1)
    {
        new house;
        if(PlayerInfo[playerid][pHouse] != -1) house = PlayerInfo[playerid][pHouse];
        else house = PlayerInfo[playerid][pArendaHouse];
        SetPlayerInterior(playerid,HouseInfo[house][hInt]);
        SetPlayerPosEx(playerid, HouseInfo[house][hExit][0], HouseInfo[house][hExit][1],HouseInfo[house][hExit][2]); // Warp the player
        SetPlayerVirtualWorld(playerid, house+50);
        if(PlayerInfo[playerid][pArendaHouse] == -1 && PlayerInfo[playerid][pHouse] != -1) LoadCarPlayer(playerid, 1), LoadCarPlayer(playerid, 2), LoadCarPlayer(playerid, 3);
        else if(PlayerInfo[playerid][pArendaHouse] != -1) LoadCarPlayer(playerid, 1);
        return 1;
    }
    if(PlayerInfo[playerid][pHotel] != -1 && PlayerInfo[playerid][pSpawn] == 1)
    {
        new hotel = PlayerInfo[playerid][pHotel];
        TogglePlayerControllable(playerid, false);
        SetTimerEx("UnFreez", 3000, false, "i", playerid);
        SetPlayerVirtualWorld(playerid, HotelInfo[hotel][mVW]);
        SetPlayerPosEx(playerid, 1325.7842,-1071.0078,3458.9060);
        SetPlayerFacingAngle(playerid, 90.2511);
        SetPlayerInterior(playerid, 2);
        return 1;
    }
    if(PlayerInfo[playerid][pCar][0] == 508)
    {
        if(PlayerInfo[playerid][pSpawn])
        {
            SetPlayerPosEx(playerid, 2531.7166,-1031.2251,54.0299);
            TogglePlayerControllable(playerid, 0);
            SetTimerEx("UnFreez", 1500, false, "i", playerid);
            SetPlayerFacingAngle(playerid, 0);
            SetPlayerVirtualWorld(playerid,caridhouse[playerid][0]);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
            SetPVarInt(playerid, "Intropic", caridhouse[playerid][0]);
            return 1;
        }
    }
    if(GetPVarInt(playerid, "AntiDeathRace"))
    {
        SetPlayerPosEx(playerid, 827.0083,5.8989,1004.1870);
        SetPlayerFacingAngle(playerid, 269.6992);
        SetPlayerInterior(playerid, 3);
        SetPlayerVirtualWorld(playerid, 300);
        DeletePVar(playerid, "AntiDeathRace");
        return 1;
    }
    new frac = PlayerInfo[playerid][pMember];
    TogglePlayerControllable(playerid, false);
    SetTimerEx("UnFreez", 3000, 0, "d", playerid);
    SetPlayerInterior(playerid, FractionInfo[frac][fractionInt]);
    SetPlayerPosEx(playerid, FractionInfo[frac][fPosX],FractionInfo[frac][fPosY],FractionInfo[frac][fPosZ]);
    SetPlayerFacingAngle(playerid, FractionInfo[frac][fPosA]);
    SetPlayerVirtualWorld(playerid, FractionInfo[frac][fractionVirt]);
    switch(PlayerInfo[playerid][pMember])
    {
         case 3,27: SetPlayerCheckpoint(playerid, -1636.9213,608.1162,-51.8141-1, 1.0), SetPVarInt(playerid, "gps_pic", 228);
        case 16: lNews[playerid] = false;
        case 6: SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
        case 14: SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
        case 11: SetPlayerCheckpoint(playerid,-2080.9053,-105.1343,2855.1479,1.5);
        case 4: pTemp[playerid][pInHospital] = true;
        case 12: SetPlayerCheckpoint(playerid, -71.5424,1366.1405,1080.2185,1.0);
        case 13: SetPlayerCheckpoint(playerid, 300.4856,302.5443,1003.5391,1.0);
        case 17: SetPlayerCheckpoint(playerid, -45.9193,1401.2159,1084.4370,1.0);
        case 18: RemovePlayerAttachedObject(playerid, 1), SetPlayerCheckpoint(playerid,-219.9765,1406.8613,27.7656,1.0);
        case 15: SetPlayerCheckpoint(playerid,1184.4584,-768.4982,1090.1138,1.0);
    }
    return 1;
}

  

Edited by odosenok

Заметка от Cawfee , создано

Правилами форума регламентировано, что необходимо код заключать в тег "Код" и, если длина кода больше десяти символов, тогда еще и в тег "Спойлер". Прочитайте, как это правильно сделать: ссылка.

Share this post


Link to post
  • 0

@Alex William, в Вашем моде есть две переменные: pModel и pChar. В первую заносится ID скина, который нужно выдать игроку, если он состоит во фракции. Соответственно, во вторую заноситься ID скина, который нужно выдать в противном случае. Если после перезахода в игру выдается другой скин, отличный от того, что был до выхода, вероятно всего, проблема в загрузке или сохранении. Показывайте загрузку аккаунта и сохранение.

Share this post


Link to post
  • 0

@odosenok 

Спойлер

stock OnPlayerSaveAccount(playerid)
{
	if(PlayerInfo[playerid][pLogin] != true) return print("Ошибка сохранения | Игрок не авторизован");
	new string[340];
	mysql_format(connects,string,340,"UPDATE `accounts` SET `pFuelcar` = '%f',`pFuelcar1` = '%f',`pFuelcar2` = '%f',`pCash` = '%d',`pMuteTime` = '%d',`pRMuteTime` = '%d',`pChar` = '%d', `pPrisonTime` = '%d', `pJailTime` = '%d', `pJailed` = '%d', `pPm` = '%d', `aPrefix` = '%s' WHERE `id` = '%i'",
	PlayerInfo[playerid][pFuelCar][0],PlayerInfo[playerid][pFuelCar][1],PlayerInfo[playerid][pFuelCar][2],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pMuteTime],PlayerInfo[playerid][pRMuteTime],PlayerInfo[playerid][pChar],
	PlayerInfo[playerid][pPrison][1],PlayerInfo[playerid][pJailTime],PlayerInfo[playerid][pJailed],PlayerInfo[playerid][pPm],PlayerInfo[playerid][aPrefix],PlayerInfo[playerid][pID]);
	mysql_empty(connects, string);
	printf("Name: %s [%d] | pID: [%d] - сохранен",PlayerInfo[playerid][pNames],playerid,PlayerInfo[playerid][pID]);
	return 1;
}

 

 

Edited by odosenok
Причина: Взял код в тег "Код".

Share this post


Link to post
  • 0

@Alex William, что ж Вы недочитываете-то вторую часть моих сообщений. Покажите команду выдачи прав лидера, покажите загрузку аккаунтов, а также какую-нибудь команду, изменяющую одежду игроку.

Share this post


Link to post
  • 0

@odosenok 

Спойлер

CMD:setleader(playerid, params[])
{
	if(PlayerInfo[playerid][bAdmin] < 11) return 1;
	if(sscanf(params,"d",params[0])) return SCM(playerid, 0xffffffFF, "• {FFCC00}[Ïîäñêàçêà] {ffffff}/setleader [ID]");
	if(!IsPlayerConnected(params[0]) || params[0] == INVALID_PLAYER_ID) return 1;
	if(PlayerInfo[params[0]][pMember] > 0) return SCM(playerid, COLOR_WHITE, "Èãðîê âî ôðàêöèè");
	if(PlayerInfo[params[0]][bAdmin] > 0 && PlayerInfo[playerid][bAdmin] != 13) return SCM(playerid, COLOR_WHITE, "/templeader [id ôðàêöèè]");
	if(PlayerInfo[params[0]][pWarns] >= 1) return SCM(playerid, 0xFF6600AA,"Ó èãðîêà Warn.");
	new string[BIG_SIZE+100];
	new str[64];
	for(new i;i!=sizeof(GetMember);i++) format(str,64,"%s\n",GetMember[i]), strcat(string, str);
	ShowPlayerDialog(playerid,1146,2,PlayerInfo[params[0]][pNames],string,"Äàëåå","Îòìåíà");
	SetPVarInt(playerid,"actplayerid",params[0]);
	return 1;
}

 

Спойлер

public OnPlayerConnect(playerid)
{
    LoadPanelSpy(playerid);
    CreatePlayerDraws(playerid);
    SetPVarInt(playerid, "spectate_samp", 0);
    LabelAdmins[playerid] = -1;
	if(LabelAdmins[playerid] > 1)
	{
	    KillTimer(counthead[playerid]);
	    LabelAdmins[playerid] = -1;
	}
    Itter_Add(Player, playerid);
	for(new pInfo:i; i < pInfo; ++i) PlayerInfo[playerid][i] = 0;
    for(new tempInfo:i; i < tempInfo; ++i) pTemp[playerid][i] = 0;
	if(ServerRestart[0])
	{
		SendClientMessage(playerid,0xffcc00ff,"Сейчас происходит рестарт сервера!");
		SendClientMessage(playerid,0xffcc00ff,"Пожалуйста, дождитесь его завершения");
		return KickEx(playerid, 2221);
	}
	new ip[24]; GetPlayerIp(playerid,ip,24);
	new num_ip = GetNumberOfPlayersOnThisIP(ip);
	if(num_ip > MAX_IP_ADRESS_CONNECT) return KickEx(playerid, 985);
	for(new i; i != 2; i++) TextDrawShowForPlayer(playerid, LOGO[i]);//TUT
//	TextDrawShowForPlayer(playerid, logo0);
	ORC{playerid} = false;
	PreloadAllAnims(playerid);
	GetPlayerName(playerid, PlayerInfo[playerid][pNames], 24);
	GetPlayerIp(playerid,PlayerInfo[playerid][pIP],16);
	g_MysqlRaceCheck[playerid]++;
	LoadPlayerDraws(playerid);
	NewTextDrawsLoad(playerid);
	RemovedObjects(playerid);
	ClearAnimations(playerid);
	SetPlayerDataToDefault(playerid);
	return 1;
}

 

 

Share this post


Link to post
  • 0

@Alex William, нет загрузки в OnPlayerConnect. Видимо, в OnPlayerRequestClass она. Эту функцию тогда помогите. А что касается команды выдачи прав лидера, покажите код диалога под ID 1146.

Share this post


Link to post
  • 0

Покажи, пожалуйста, диалог 1146, и ещё в следующий раз, пожалуйста, копируй код в русской раскладке. 

Share this post


Link to post
  • 0

@Покемон

Спойлер

	case 1146:
		{
			if(!response) return 1;
			new fractionid = listitem;
			SetPVarInt(playerid,"actfraction",fractionid);
			new mes[256];
			for(new i;i<20;i++)
			{
				new skinid = ChangeSkin[fractionid][i];
				if(!skinid) break;
				if(!i) format(mes,sizeof(mes),"Скин %d [%d]",i+1,skinid);
				else format(mes,sizeof(mes),"%s\nСкин %d [%d]",mes,i+1,skinid);
			}
			new actplayerid = GetPVarInt(playerid,"actplayerid");
			ShowPlayerDialog(playerid,9185,2,PlayerInfo[actplayerid][pNames],mes,"Принять","Отмена");
			return 1;
		}

 

 

Share this post


Link to post
  • 0

@odosenok 

Спойлер
Цитата

    case 9185:
        {
            if(!response) return DeletePVar(playerid, "actplayerid");
            new actplayerid = GetPVarInt(playerid,"actplayerid");
            new fractionid = GetPVarInt(playerid,"actfraction");
            new skinid = ChangeSkin[fractionid][listitem];
            new rank = rangFractionID[fractionid];
            PlayerInfo[actplayerid][pMember] = fractionid+1;
            PlayerInfo[actplayerid][pLeader] = fractionid+1;
            PlayerInfo[actplayerid][pRank] = rank;
            if(PlayerInfo[actplayerid][pMember] == 3 || PlayerInfo[actplayerid][pMember] == 19 || PlayerInfo[actplayerid][pMember] == 27) PlayerInfo[actplayerid][ArmyPlay] = 1, strmid(PlayerInfo[actplayerid][ArmyRank], PlayerRank[PlayerInfo[actplayerid][pMember]-1][PlayerInfo[actplayerid][pRank]-1], 0, strlen(PlayerRank[PlayerInfo[actplayerid][pMember]-1][PlayerInfo[actplayerid][pRank]-1]), 255);
            PlayerInfo[actplayerid][pModel] = skinid;
            PlayerInfo[actplayerid][pJob] = 0;
            new query[230];
            mysql_format(connects,query,sizeof(query),"UPDATE `accounts` SET `pMember` = '%d', `pRank` = '%d', `pModel` = '%d', `pLeader` = '%d', `pJob` = '0', `ArmyPlay` = '%d', `ArmyRank` = '%s' WHERE `id` = '%d'",fractionid+1,rank,skinid,fractionid+1,PlayerInfo[actplayerid][ArmyPlay],PlayerInfo[actplayerid][ArmyRank],PlayerInfo[actplayerid][pID]);
            mysql_empty(connects, query);
            SetPlayerColor(actplayerid, FractionInfo[PlayerInfo[actplayerid][pMember]][fColor]);
            new day,month,year,hour,minuite,second;
            getdate(year, month, day);
            gettime(hour,minuite,second);
            FixHour(hour);
            hour = shifthour;
            new data2[64];
            format(data2, 16, "%02d.%02d.%d в %02d:%d",day,month,year,hour,minuite);
            new string[MAX_SQL];
            mysql_format(connects, string, MAX_SQL, "INSERT INTO `logs` (`Text`, `Date`) VALUES ('%s выдал лидерку %s фракции %d','%s')",PlayerInfo[playerid][pNames],PlayerInfo[params[0]][pNames],params[1],data2);
            mysql_empty(connects, string);
            SCMF(playerid, CYELLOW,"%s {"#cWHITE"}был назначен лидером фракции {"#cINFO"}\"%s\"",PlayerInfo[actplayerid][pNames],GetMember[fractionid]);
            SCMF(actplayerid, CINFO, "Администратор %s назначил вас лидером фракции \"%s\"",PlayerInfo[playerid][pNames],GetMember[fractionid]);
            new mes[128];
            format(mes,sizeof(mes),"[A] Администратор %s назначил %s лидером фракции \"%s\"",PlayerInfo[playerid][pNames],PlayerInfo[actplayerid][pNames],GetMember[fractionid]);
            ABroadCast(0xAFAFAFFF, mes, 1);
            SetPlayerSkin(actplayerid,skinid);
            if(StartRabWork(actplayerid))
            {
                SetPVarInt(actplayerid, "StartRabWork", 1);
            }
            return 1;
        }

 

 

Share this post


Link to post
  • 0

@Alex William, Вы снова читаете лишь одну часть сообщения. Мне нужно увидеть загрузку аккаунта, ее Вы так и не показали. OnPlayerRequestClass скидывайте.

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Александр_Вольт
      By Александр_Вольт
      Нужны 
      Скриптеры 
      3д модельеры
      Админы 
      и т.д
    • fresko241
      By fresko241
      Привет, я только обучаюсь разработке. Хочу узнать у меня есть радио, музыка играет. Но как можно сделать чтобы музыка играла только в машине и слышна была и людям которые возле нее.