Переменные новый синтаксис
Код:
static trash[MAX_PLAYERS]; static tipograv[2]; static jobpic[2]; static skinjob[2]; static jobanim[8];
Событие OnGameModeInit
OnGameModeInit
Код:jobpic[0] = CreatePickup(365,2,-1080.8242, -277.6349, 12.0882); skinjob[0] = CreatePickup(409,2,-1081.0825, -280.6678, 12.0882); jobanim[0] = CreatePickup(365,2,-1065.7335, -275.9042, 12.0882); jobanim[1] = CreatePickup(365,2,-1072.8418, -280.0342, 12.0882); jobanim[2] = CreatePickup(365,2,-1072.8142, -276.6037, 12.0882); jobanim[3] = CreatePickup(365,2,-1072.9274, -283.3184, 12.0882); jobanim[4] = CreatePickup(365,2,-1072.9540, -286.7246, 12.0882); jobanim[5] = CreatePickup(365,2,-1066.8749, -283.2624, 12.0882); jobanim[6] = CreatePickup(365,2,-1066.8070, -286.7194, 12.0882); jobanim[7] = CreatePickup(365,2,-1069.5027, -275.9603, 12.0882); tipograv[0] = CreatePickup(383, 2, -1062.7959, -279.0299, 12.0879);//вход tipograv[1] = CreatePickup(383, 2, -1064.8613, -279.2804, 12.0882);//выход CreateObject(1604, -1063.7729, -278.9320, 13.0240, 0.000000, 0.000000, 0.000000);
Событие OnPlayerPickUpPickup
OnPlayerPickUpPickup
Код:if(pickupid == tipograv[0]) { SetPlayerPos(playerid,-1067.8372, -278.6228, 12.0882); SetPlayerFacingAngle(playerid,86.9154); SetPlayerInterior(playerid, 18); SetPlayerVirtualWorld(playerid, 0); } else if(pickupid == tipograv[1]) { SetPlayerPos(playerid,-1058.5007, -278.9783, 11.3145); SetPlayerFacingAngle(playerid,270.5203); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); } else if(pickupid == jobanim[0]) { if(GetPVarInt(playerid, "jobactive") == 0) return SendClientMessage(playerid, -1, " * Вы еще не устроились!"); { ApplyPlayerAnimation(playerid, 0, 171, 1); SetTimer("Animation1",5000,0); } } else if(pickupid == jobanim[1]) { if(GetPVarInt(playerid, "JobList") == 0) return SendClientMessage(playerid, -1, " * Вы еще не брали бумагу!"); { if(GetPVarInt(playerid, "JobList_x2") == 3) return SendClientMessage(playerid, -1, " * Вы уже напечатали купюру!"); { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation2",1000,0); } } } else if(pickupid == jobanim[2]) { if(GetPVarInt(playerid, "JobList") == 0) return SendClientMessage(playerid, -1, " * Вы еще не брали бумагу!"); { if(GetPVarInt(playerid, "JobList_x2") == 3) return SendClientMessage(playerid, -1, " * Вы уже напечатали купюру!"); { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation2",1000,0); } } } else if(pickupid == jobanim[3]) { if(GetPVarInt(playerid, "JobList") == 0) return SendClientMessage(playerid, -1, " * Вы еще не брали бумагу!"); { if(GetPVarInt(playerid, "JobList_x2") == 3) return SendClientMessage(playerid, -1, " * Вы уже напечатали купюру!"); { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation2",1000,0); } } } else if(pickupid == jobanim[4]) { if(GetPVarInt(playerid, "JobList") == 0) return SendClientMessage(playerid, -1, " * Вы еще не брали бумагу!"); { if(GetPVarInt(playerid, "JobList_x2") == 3) return SendClientMessage(playerid, -1, " * Вы уже напечатали купюру!"); { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation2",1000,0); } } } else if(pickupid == jobanim[5]) { if(GetPVarInt(playerid, "JobList") == 0) return SendClientMessage(playerid, -1, " * Вы еще не брали бумагу!"); { if(GetPVarInt(playerid, "JobList_x2") == 3) return SendClientMessage(playerid, -1, " * Вы уже напечатали купюру!"); { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation2",1000,0); } } } else if(pickupid == jobanim[6]) { if(GetPVarInt(playerid, "JobList") == 0) return SendClientMessage(playerid, -1, " * Вы еще не брали бумагу!"); { if(GetPVarInt(playerid, "JobList_x2") == 3) return SendClientMessage(playerid, -1, " * Вы уже напечатали купюру!"); { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation2",1000,0); } } } else if(pickupid == jobanim[7]) { if(GetPVarInt(playerid, "JobList_x2") == 0) return SendClientMessage(playerid, -1, " * Вы еще не напечатали купюру!"); { new string[256]; ApplyPlayerAnimation(playerid, 0, 171, 1); SetPVarInt(playerid, "JobMoney", GetPVarInt(playerid, "JobMoney") + 10); format(string, sizeof(string), " * Вы заработали %d$",GetPVarInt(playerid, "JobMoney")); SendClientMessage(playerid, -1, string); SetPVarInt(playerid, "JobList_x2", 0); SetPVarInt(playerid, "JobList", 0); } } else if(pickupid == jobpic[0]) { SendClientMessage(playerid, -1, " * Начать|Закончить рабочий день - /jobtep"); SendClientMessage(playerid, -1, " * Начать - 1, Закончить - 2 /jobtep [Начать - 1, Закончить - 0]"); } else if(pickupid == skinjob[0]) { if(GetPVarInt(playerid, "jobtep") == 0) return SendClientMessage(playerid, -1, " * Вы еще не устроились на работу"); { if(GetPlayerSkin(playerid) == 149) return SendClientMessage(playerid, -1, " * Вы уже переоделись в форму рабочего!"); SetPlayerSkin(playerid, 149); SendClientMessage(playerid, -1, " * Рабочий день начат."); }
Таймеры
Timers
Код:forward Animation1(playerid); public Animation1(playerid) { SetPVarInt(playerid, "JobList", GetPVarInt(playerid, "JobList") + 5); SendClientMessage(playerid, -1, " * Вы взяли 5 метров листовой бумаги."); SendClientMessage(playerid, -1, " * Подойдите к станку для распичатки купюры."); return 1; } forward Animation2(playerid); public Animation2(playerid) { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation3",1000,0); return 1; } forward Animation3(playerid); public Animation3(playerid) { ApplyPlayerAnimation(playerid, 0, 62, 18); SetTimer("Animation4",1000,0); return 1; } forward Animation4(playerid); public Animation4(playerid) { ApplyPlayerAnimation(playerid, 0, 62, 18); SetPVarInt(playerid, "JobList_x2", GetPVarInt(playerid, "JobList_x2") + 3); SendClientMessage(playerid, -1, " * Вы напечатали 3 метра купюры."); SendClientMessage(playerid, -1, " * Сложите на стелаж."); return 1; }
Событие OnPlayerCommandText
OnPlayerCommandText
Код:public OnPlayerCommandText(playerid, cmdtext[]) { new cmd_sscanf[32], params[128]; sscanf(cmdtext, "s[32]s[128]", cmd_sscanf, params); //================================// if(strcmp(cmd_sscanf, "/jobtep", true) == 0) { if(IsPlayerInRangeOfPoint(playerid, 2.0, -1080.8242, -277.6349, 12.0882)) { new string[256]; if(sscanf(params,"d",params[0])) return SendClientMessage(playerid, -1, " * Используйте: /jobtep [Начать - 1, Закончить - 0]"); trash[playerid] = params[0]; if(trash[playerid] == 1) { SendClientMessage(playerid, -1, " * Вы устроились на работу."); SendClientMessage(playerid, -1, " * Для начала рабочего дня, переоденьтесь в форму рабочего."); SetPVarInt(playerid, "jobtep", GetPVarInt(playerid, "jobtep") + 1); SetPVarInt(playerid, "jobactive", 1); } if(trash[playerid] == 0) { SendClientMessage(playerid, -1, " * Вы закончили рабочий день."); format(string, sizeof(string), " * Вы заработали %d ", GetPVarInt(playerid, "JobMoney")); SendClientMessage(playerid, -1, string); GivePlayerMoney(playerid,GetPVarInt(playerid, "JobMoney")); SetPlayerSkin(playerid,ваша переменная скина); SetPVarInt(playerid, "jobtep", 0); SetPVarInt(playerid, "JobMoney", 0); } } else { SendClientMessage(playerid, -1, " * Вы далеко от пикапа работы!"); } return 1; } return 0; }
Автор:Alexander