14.07.2010, 21:59
I own an RP server and i want to create a mobile data computer for police officers. It already has one, but i want to make it a GUI, and have more than 1 function.
Currently:
Here's what i have:
What should i edit to make it work? When you select Issue warrant, a dialog box should pop up, you type player's name and that should send as /asu [id] [reason]
Help appreciated!
Currently:
Код:
if(strcmp(cmd, "/mdc", true) == 0) { if(IsPlayerConnected(playerid)) { if(!IsACop(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop !"); return 1; } if(PlayerInfo[playerid][pDBanned] == 1) { SendClientMessage(playerid, COLOR_GREY, "* You are Suspended from Duty!"); return 1; } new tmpcar = GetPlayerVehicleID(playerid); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /mdc [playerid/PartOfName]"); return 1; } //giveplayerid = strval(tmp); giveplayerid = ReturnUser(tmp); if(IsACopCar(tmpcar)||IsASwatCar(tmpcar)||IsASpecialFCar(tmpcar)||IsATacticalCar(tmpcar)||IsAnFbiCar(tmpcar)||IsNgCar(tmpcar)||IsPlayerInRangeOfPoint(playerid, 5, 253.9280,69.6094,1003.6406)) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, sendername, sizeof(sendername)); SendClientMessage(playerid, TEAM_BLUE_COLOR,"______-=MOBILE DATA COMPUTER=-_______"); format(string, sizeof(string), "Name : %s", sendername); SendClientMessage(playerid, COLOR_WHITE,string); format(string, sizeof(string), "Crime : %s", PlayerCrime[giveplayerid][pAccusedof]); SendClientMessage(playerid, COLOR_GRAD2,string); format(string, sizeof(string), "Claimant : %s", PlayerCrime[giveplayerid][pVictim]); SendClientMessage(playerid, COLOR_GRAD3,string); format(string, sizeof(string), "Reported : %s", PlayerCrime[giveplayerid][pAccusing]); SendClientMessage(playerid, COLOR_GRAD4,string); format(string, sizeof(string), "Accused : %s", PlayerCrime[giveplayerid][pBplayer]); SendClientMessage(playerid, COLOR_GRAD5,string); SendClientMessage(playerid, TEAM_BLUE_COLOR,"_______________________________________"); GetPlayerName(playerid, giveplayer, sizeof(giveplayer)); new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /mdc %s",d,m,y,h,mi,s,giveplayer, sendername); CommandLog(string); } } else { SendClientMessage(playerid, COLOR_GREY, " That player is Offline !"); return 1; } } else { SendClientMessage(playerid, COLOR_GRAD2, " You are not in a Police Vehicle or in the Police Department."); return 1; } } return 1; }
Код:
#define MDC_MENU_ITEMS 4 new Menu:mdcMenu; new TestMenuStrings[4][16] = {"Warrants"}; HandleTestMenuSelection(playerid, row) { new s[256]; if(row < Mdc_MENU_ITEMS) { format(s,256,"You selected item %s",TestMenuStrings[row]); SendClientMessage(playerid,0xFFFFFFFF,s); } } InitmdcMenu() { mdcMenu = CreateMenu("MOBILE DATA COMPUTER", 1, 200.0, 150.0, 200.0, 200.0); AddMenuItem(mdcmenu, 0, "Check Warrants"); AddMenuItem(mdcmenu, 1, "Check Warrant"); for(new x=0; x < MDC_MENU_ITEMS; x++) { AddMenuItem(MdcMenu, 0, MdcMenuStrings[x]); } } public OnFilterScriptInit() { InitMdcMenu(); } public OnPlayerSelectedMenuRow(playerid, row) { new Menu:PlayerMenu = GetPlayerMenu(playerid); if(PlayerMenu == mdcMenu) { switch(row) { case 0: //View Warrants { public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(!IsPlayerFBI(playerid)) return 0; // this is an admin only script if(dialogid == 1) { if(!response) return SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!"); return 1; } return 0; } ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Enter Name","Enter Player's Name","Check for Warrant","Cancel"); } { GetPlayerName(giveplayerid, sendername, sizeof(sendername)); SendClientMessage(playerid, TEAM_BLUE_COLOR,"______-=MOBILE DATA COMPUTER=-_______"); format(string, sizeof(string), "Name : %s", sendername); SendClientMessage(playerid, COLOR_WHITE,string); format(string, sizeof(string), "Crime : %s", PlayerCrime[giveplayerid][pAccusedof]); SendClientMessage(playerid, COLOR_GRAD2,string); format(string, sizeof(string), "Claimant : %s", PlayerCrime[giveplayerid][pVictim]); SendClientMessage(playerid, COLOR_GRAD3,string); format(string, sizeof(string), "Reported : %s", PlayerCrime[giveplayerid][pAccusing]); SendClientMessage(playerid, COLOR_GRAD4,string); format(string, sizeof(string), "Accused : %s", PlayerCrime[giveplayerid][pBplayer]); SendClientMessage(playerid, COLOR_GRAD5,string); SendClientMessage(playerid, TEAM_BLUE_COLOR,"_______________________________________"); GetPlayerName(playerid, giveplayer, sizeof(giveplayer)); new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /mdc %s",d,m,y,h,mi,s,giveplayer, sendername); CommandLog(string); } } } } } public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/mdc", true)) { ShowMenuForPlayer(mdcMenu, playerid); return 1; } return 0; }
Help appreciated!