BJIADOKC |
Сообщение # 1 | 14:59:17 11 Ноя 2010 |
Скриптеры
Сообщений: 601
|
В этом уроке будем учиться делать самую простую синхронизацию (на клавишу num6) в самое начало: Code new name[100], string[200], string2[200]; new bool:SyncUsed[MAX_PLAYERS]; Затем ищем паблик OnPlayerKeyStateChange (Если нет такого создайте) Code public OnPlayerKeyStateChange(playerid,newkeys,oldkeys) { ... return 1; } и вставляем в него: Code if(!IsPlayerConnected(playerid) || playerid == INVALID_PLAYER_ID) return 0; if(newkeys == 16384 && IsPlayerConnected(playerid) && playerid != INVALID_PLAYER_ID) { if(SyncUsed[playerid] == true) return SendClientMessage(playerid, 0xFF4040FF, "Синхронизацией можно пользоваться только раз в 10 секунд!"); SyncUsed[playerid] = true; new w1, w2, w3, w4, w5, w6, w7, w8, w9, a10; new a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; new Float:x, Float:y, Float:z; new act = GetPlayerSpecialAction(playerid); new vw = GetPlayerVirtualWorld(playerid); new money = GetPlayerMoney(playerid); new skin = GetPlayerSkin(playerid); new inter = GetPlayerInterior(playerid); new Float:hp, Float:arm; GetPlayerHealth(playerid, hp); GetPlayerArmour(playerid, arm); GetPlayerPos(playerid, x, y, z); GetPlayerName(playerid, name, 100); GetPlayerWeaponData(playerid, 1, w1, a1); GetPlayerWeaponData(playerid, 2, w2, a2); GetPlayerWeaponData(playerid, 3, w3, a3); GetPlayerWeaponData(playerid, 4, w4, a4); GetPlayerWeaponData(playerid, 5, w5, a5); GetPlayerWeaponData(playerid, 6, w6, a6); GetPlayerWeaponData(playerid, 7, w7, a7); GetPlayerWeaponData(playerid, 8, w8, a8); GetPlayerWeaponData(playerid, 9, w9, a9); GetPlayerWeaponData(playerid, 10, w10, a10); ClearAnimations(playerid); SetPlayerSkin(playerid, skin); SetPlayerInterior(playerid, inter); SetPlayerPos(playerid, x, y, z); SetPlayerHealth(playerid, hp); SetPlayerArmour(playerid, arm); SetPlayerName(playerid, name); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, money); SetPlayerSpecialAction(playerid, act); SetPlayerVirtualWorld(playerid, virt); ResetPlayerWeapons(playerid); GivePlayerWeapon(playerid, w1, a1); GivePlayerWeapon(playerid, w2, a2); GivePlayerWeapon(playerid, w3, a3); GivePlayerWeapon(playerid, w4, a4); GivePlayerWeapon(playerid, w5, a5); GivePlayerWeapon(playerid, w6, a6); GivePlayerWeapon(playerid, w7, a7); GivePlayerWeapon(playerid, w8, a8); GivePlayerWeapon(playerid, w9, a9); GivePlayerWeapon(playerid, w10, w10); format(string,200,"ofc 0.0600"); format(string2,200,"icc 0.0080"); CallRemoteFunction("OnPlayerCommandText","Is", string); CallRemoteFunction("OnPlayerCommandText","Is", string2); SetTimer("UnuseSync", 10000, false); } и в самый конец вставляем: Code public UnuseSync(playerid) { if(SyncUsed[playerid] == true) return SyncUsed[playerid] = false; if(!SyncUsed[playerid]) return 0; return 1; } вставляем строчку в OnPlayerConnect Code SyncUsed[playerid] = false; и в OnPlayerDisconnect Code SyncUsed[playerid] = false; урок от BJIADOKC
тут больше не сижу... открыл свой проект
Редактировано BJIADOKC - Четверг, 11 Ноя 2010, 15:04:40 |
|