30.11.2010, 18:36
(
Последний раз редактировалось maxtorcd55; 30.11.2010 в 19:18.
)
I created a "Player Info" command.
pictures:
Photo_1
Photo_2
sorry for my bad english.
pictures:
Photo_1
Photo_2
sorry for my bad english.
Код:
new idplayerinfo[MAX_PLAYERS]; new idgoto[MAX_PLAYERS]; public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/playerinfo", cmdtext, true, 10) == 0) { new allply[1028]; for (new i = 0; i <= 50; i++) { if(IsPlayerConnected(i)) { new pName[MAX_PLAYER_NAME]; GetPlayerName(i,pName,MAX_PLAYER_NAME); if (IsPlayerNPC(i)){format(allply,sizeof allply,"\n%s\n%s (%d) [NPC]",allply,pName,i);}else{format(allply,sizeof allply,"\n%s\n%s (%d)",allply,pName,i);} } else { format(allply,sizeof allply,"\n%s\noffline (%d)",allply,i); } } ShowPlayerDialog(playerid, PlayerInfoDia[0], DIALOG_STYLE_LIST, "player list", allply,"select", "Cancel"); return 1; } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == PlayerInfoDia[0]) { if(response) { idplayerinfo[playerid] = listitem; new id=idplayerinfo[playerid] ,sstate[128],type[28]; new Float:h,Float:a; new Float:x,Float:y,Float:z; GetPlayerPos(id,x,y,z); GetPlayerHealth(id,h); GetPlayerArmour(id,a); new sstring[698],pName[MAX_PLAYER_NAME]; GetPlayerName(id,pName,MAX_PLAYER_NAME); if(IsPlayerNPC(id)==0){type="actual player";} if(IsPlayerNPC(id)==1){type="npc";} if(GetPlayerState(id)==1){sstate="onfoot";} if(GetPlayerState(id)==2){sstate="driver";} if(GetPlayerState(id)==3){sstate="passenger";} if(GetPlayerState(id)==7){sstate="wasted/class selection";} if(GetPlayerState(id)==8){sstate="spawned";} if(GetPlayerState(id)==9){sstate="spectating";} format(sstring,sizeof sstring,"name: %s\nID: %d \ntype: %s\nmoney: %d\nstate: %s\nhealth: %.0f\narmour: %.0f\nspeed: %d\nping: %d\nX,Y: %.0f, %.0f\nheight: %.0f\nScore : %d",pName,id,type,GetPlayerMoney(id),sstate,h,a,GetPlayerSpeed(id),GetPlayerPing(id),x,y,z,GetPlayerScore(id)); ShowPlayerDialog(playerid, PlayerInfoDia[1], DIALOG_STYLE_MSGBOX, "playerinfo", sstring,"refresh", "Back"); } return 1; } if(dialogid == PlayerInfoDia[1]) { if(response) { new id=idplayerinfo[playerid] ,sstate[128], plrIP[16],type[28]; new sstring[698],pName[MAX_PLAYER_NAME]; new Float:h,Float:a; new Float:x,Float:y,Float:z; if(IsPlayerConnected(id)) { GetPlayerIp(id, plrIP, sizeof(plrIP)); GetPlayerPos(id,x,y,z); GetPlayerHealth(id,h); GetPlayerArmour(id,a); GetPlayerName(id,pName,MAX_PLAYER_NAME); if(IsPlayerNPC(id)==0){type="actual player";} if(IsPlayerNPC(id)==1){type="npc";} if(GetPlayerState(id)==1){sstate="onfoot";} if(GetPlayerState(id)==2){sstate="driver";} if(GetPlayerState(id)==3){sstate="passenger";} if(GetPlayerState(id)==7){sstate="wasted/class selection";} if(GetPlayerState(id)==8){sstate="spawned";} if(GetPlayerState(id)==9){sstate="spectating";} } format(sstring,sizeof sstring,"name: %s\nID: %d \ntype: %s\nmoney: %d\nstate: %s\nhealth: %.0f\narmour: %.0f\nspeed: %d\nping: %d\nX,Y: %.0f, %.0f\nheight: %.0f\nScore : %d",pName,id,type,GetPlayerMoney(id),sstate,h,a,GetPlayerSpeed(id),GetPlayerPing(id),x,y,z,GetPlayerScore(id)); ShowPlayerDialog(playerid, PlayerInfoDia[1], DIALOG_STYLE_MSGBOX, "playerinfo", sstring,"refresh", "Back"); }else{ new allply[1028]; for (new i = 0; i <= 50; i++) { if(IsPlayerConnected(i)) { new pName[MAX_PLAYER_NAME]; GetPlayerName(i,pName,MAX_PLAYER_NAME); if (IsPlayerNPC(i)){format(allply,sizeof allply,"\n%s\n%s (%d) [NPC]",allply,pName,i);}else{format(allply,sizeof allply,"\n%s\n%s (%d)",allply,pName,i);} } else { format(allply,sizeof allply,"\n%s\noffline (%d)",allply,i); } } ShowPlayerDialog(playerid, PlayerInfoDia[0], DIALOG_STYLE_LIST, "playerinfo", allply,"select", "Cancel"); } return 1; } return 0; }