Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock NPCTalk(npcname[],text[],talkto=-1,chat=1,bubble=0,anim=0)
- {
- /*new string[M_S], npcid = GetNPCID(npcname), playerid = -1;
- for(new i = 0; i < MAX_PLAYERS_ && playerid == -1; i++) if(IsPlayerConnected(i) && equal(GetName(i),NPCs[npcid][npcName])) playerid = i;
- format(string,sizeof(string),"%s: {FFFFFF}%s",NPCs[npcid][npcName],text);
- if(chat)
- {
- if(talkto == -1) SendClientMessageToAll(GetPlayerColor(playerid),string);
- else SendClientMessage(talkto,GetPlayerColor(playerid),string);
- }
- if(playerid != -1)
- {
- if(!playerinfo[playerid][stoprob])
- {
- switch(anim)
- {
- case 0:
- {
- ApplyAnimation(playerid,"PED","IDLE_chat",4.1,0,1,1,1,1);
- playerinfo[playerid][clearanims] = 5;
- }
- }
- if(bubble && strlen(text) < 120)
- {
- //new col = GetPlayerColor(playerid);
- if(talkto != -1)
- {
- //col = GetPlayerColor(talkto);
- format(string,sizeof(string),playerinfo[talkto][rname]);
- format(string,sizeof(string),",%s\n%s",!PlayerDefinedName(talkto) ? (GetName(talkto)) : (string),talkBubble);
- SetPlayerChatBubble(playerid,string,white,15.0,5000);
- }
- else SetPlayerChatBubble(playerid,talkBubble,white,15.0,5000);
- }
- }
- } Some shits of my own code. Take a look if you want! */
- new string[128], playerid = INVALID_PLAYER_ID;
- for(new i = 0; i < MAX_PLAYERS && playerid == INVALID_PLAYER_ID; i++) if(IsPlayerConnected(i) && IsPlayerNPC(i))
- {
- GetPlayerName(i,string,MAX_PLAYER_NAME);
- if(equal(string,npcname)) playerid = i;
- }
- format(string,sizeof(string),"%s: {FFFFFF}%s",string,text);
- if(chat)
- {
- if(talkto == -1) SendClientMessageToAll(GetPlayerColor(playerid),string);
- else SendClientMessage(talkto,GetPlayerColor(playerid),string);
- }
- if(bubble) SetPlayerChatBubble(playerid,text,0xffffffaa,15.0,5000);
- if(anim) ApplyAnimation(playerid,"PED","IDLE_chat",4.1,0,1,1,1,1);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement