20.05.2016, 08:22
Код:
public ycmd_toll(playerid, cmdtext[]) { #if TollFS == 0 if(cmdtext[0] == 1) cmdtext[0] = 0; if(!gPlayerLogged[playerid]) { SendClientMessage(playerid, COLOR_RED, "You are not logged in."); return 1; } #endif if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"You're not rcon admin."); new idx, L_sz_Input[256], L_sz_MessageString[256]; L_sz_Input = strtok(cmdtext, idx); if(IsNull(L_sz_Input)) { SendClientMessage(playerid, COLOR_YELLOW, "Toll barrier command central for Los Santos"); SendClientMessage(playerid, COLOR_GRAD2, "emergency/release - (Un)Locks all the barriers."); SendClientMessage(playerid, COLOR_GRAD2, "flint - (Un)locks flint tolls."); SendClientMessage(playerid, COLOR_GRAD2, "richman - (Un)locks Richman tunnel tolls."); SendClientMessage(playerid, COLOR_GRAD2, "lv - (Un)locks the Las Venturas Highway tolls."); return 1; } if(strcmp(L_sz_Input, "emergency", true, strlen(L_sz_Input)) == 0) { aTolls[FlintToll][E_tLocked] = 1; aTolls[RichmanToll][E_tLocked] = 1; aTolls[LVToll][E_tLocked] = 1; Toll_CloseToll(FlintToll); Toll_CloseToll(RichmanToll); Toll_CloseToll(LVToll); new L_i_Time = (GetUnixTime() + TollTimerEmergency); aTolls[FlintToll][E_tTimer] = L_i_Time; aTolls[RichmanToll][E_tTimer] = L_i_Time; aTolls[LVToll][E_tTimer] = L_i_Time; format(L_sz_MessageString, 256, "** HQ Announcement: All toll booths were LOCKED by %s! **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } else if(strcmp(L_sz_Input, "release", true, strlen(L_sz_Input)) == 0) { aTolls[FlintToll][E_tLocked] = 0; aTolls[RichmanToll][E_tLocked] = 0; aTolls[LVToll][E_tLocked] = 0; format(L_sz_MessageString, 256, "** HQ Announcement: All toll booths were UNLOCKED by %s! **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } else if(strcmp(L_sz_Input, "flint", true, strlen(L_sz_Input)) == 0) { if(aTolls[FlintToll][E_tLocked] == 0) { aTolls[FlintToll][E_tLocked] = 1; aTolls[FlintToll][E_tTimer] = (GetUnixTime() + TollTimer); Toll_CloseToll(FlintToll); format(L_sz_MessageString, 256, "** HQ Announcement: Toll booths at Flint County were LOCKED by %s. **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } else { aTolls[FlintToll][E_tLocked] = 0; format(L_sz_MessageString, 256, "** HQ Announcement: Toll booths at Flint County were UNLOCKED by %s. **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } } else if(strcmp(L_sz_Input, "richman", true, strlen(L_sz_Input)) == 0) { if(aTolls[RichmanToll][E_tLocked] == 0) { aTolls[RichmanToll][E_tLocked] = 1; aTolls[RichmanToll][E_tTimer] = (GetUnixTime() + TollTimer); Toll_CloseToll(RichmanToll); format(L_sz_MessageString, 256, "** HQ Announcement: Toll booths at Richman were LOCKED by %s. **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } else { aTolls[RichmanToll][E_tLocked] = 0; format(L_sz_MessageString, 256, "** HQ Announcement: Toll booths at Richman were UNLOCKED by %s. **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } } else if(strcmp(L_sz_Input, "lv", true) == 0) { if(aTolls[LVToll][E_tLocked] == 0) { aTolls[LVToll][E_tLocked] = 1; aTolls[LVToll][E_tTimer] = (GetUnixTime() + TollTimer); Toll_CloseToll(LVToll); format(L_sz_MessageString, 256, "** HQ Announcement: Toll booths at Las Venturas were LOCKED by %s. **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } else { aTolls[LVToll][E_tLocked] = 0; format(L_sz_MessageString, 256, "** HQ Announcement: Toll booths at Las Venturas were UNLOCKED by %s. **", GetName(playerid)); SendTeamTypeMessage(1, TEAM_BLUE_COLOR, L_sz_MessageString); } } return 1; }
Код:
GetName(playerid) { new JName[MAX_PLAYER_NAME]; GetPlayerName(playerid,JName,MAX_PLAYER_NAME); return JName; }