Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dcmd_chiama(playerid, params[])
- {
- new number, s[128], calledid=-1;
- if (sscanf(params, "u", number)) SendClientMessage(playerid, COLOR_ALERT, "{33CCFF}[INFO:]{FFFFFF} /chiama [numero]");
- else if (PlayerInfo[playerid][pphonenumber]==0) SendClientMessage(playerid, COLOR_NO, "Non hai un Cellulare");
- else if(PlayerInfo[playerid][pphonecallstatus]) SendClientMessage(playerid, COLOR_ALERT, "Sei già in chiamata, devi prima riagganciare");
- else
- {
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
- PlayerInfo[playerid][pphoneservice]=0;
- switch (number)
- {
- case 100://lista servizi
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 112 - Polizia");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 118 - Ospedale");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 404 - Traffico residuo");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 555 - Taxy");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 222 - PizzaBoy");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 444 - Meccanico");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- case 112://puli
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo agente disponibile");
- PlayerInfo[playerid][pphoneservice]=112;
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_POLICE && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono agenti disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
- }
- case 118://medici
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo medico disponibile");
- PlayerInfo[playerid][pphoneservice]=118;
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_MEDICS && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono medici disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
- }
- case 555://taxy
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo tassista disponibile");
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_TAXY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono tassisti disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
- }
- case 222://pizzaboy
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo pizzaboy disponibile");
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_PIZZABOY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono pizzaboy disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
- }
- case 444://meccanico
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo meccanico disponibile");
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_MECHANICIAN && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono meccanici disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
- }
- case 404://traffico residuo
- {
- format(s,sizeof(s),"[SMS] 404: Traffico residuo %d$",PlayerInfo[playerid][pphonemoney]);
- SendClientMessage(playerid,COLOR_PHONESMS,s);
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- }
- if (PlayerInfo[playerid][pphonemoney]<PHONE_TALK_PRICE*2 && PlayerInfo[playerid][pphoneservice]==0)
- {
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
- SendClientMessage(playerid, COLOR_NO, "Non hai abbastanza soldi nel cellulare");
- return 1;
- }
- new actiontext[MAX_CHATBUBBLE_LENGTH+1];
- format(s,sizeof(s),"* %s prende il cellulare, digita il numero e lo mette all'orecchio *",PlayerInfo[playerid][pname]);
- SendRangedMessage(playerid,COLOR_ME,s);
- format(actiontext,MAX_CHATBUBBLE_LENGTH,"* prende il suo cellulare e lo mette all'orecchio *");
- SetPlayerChatBubble(playerid,actiontext,COLOR_BUBBLE,30.0,10000);
- if(calledid==-1)
- {
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pphonenumber]==number)
- {
- calledid=x;
- break;
- }
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Il numero da lei chiamato e' inesistente");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- else if(calledid==playerid) return SendClientMessage(playerid, COLOR_NO, "Non puoi chiamare te stesso");
- else if(PlayerInfo[calledid][pphonecallstatus]) return SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Numero occupato");
- SendClientMessage(playerid, COLOR_INFO, "Premi il tasto destro del mouse per riagganciare");
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] -- Attendere --");
- PlayerInfo[playerid][pphonecallstatus]=1;
- PlayerInfo[playerid][pphonecallwith]=calledid;
- PlayerInfo[calledid][pphonecallstatus]=2;
- PlayerInfo[calledid][pphonecallwith]=playerid;
- PlayerInfo[playerid][pphonecalltry]=0;
- SetTimerEx("PlayerPhoneTo",4000,false,"dd",playerid,calledid);
- }
- return 1;
- }dcmd_chiama(playerid, params[])
- {
- new number, s[128], calledid=-1;
- if (sscanf(params, "u", number)) SendClientMessage(playerid, COLOR_ALERT, "{33CCFF}[INFO:]{FFFFFF} /chiama [numero]");
- else if (PlayerInfo[playerid][pphonenumber]==0) SendClientMessage(playerid, COLOR_NO, "Non hai un Cellulare");
- else if(PlayerInfo[playerid][pphonecallstatus]) SendClientMessage(playerid, COLOR_ALERT, "Sei già in chiamata, devi prima riagganciare");
- else
- {
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
- PlayerInfo[playerid][pphoneservice]=0;
- switch (number)
- {
- case 100://lista servizi
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 112 - Polizia");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 118 - Ospedale");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 404 - Traffico residuo");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 555 - Taxy");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 222 - PizzaBoy");
- SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 444 - Meccanico");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- case 112://puli
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo agente disponibile");
- PlayerInfo[playerid][pphoneservice]=112;
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_POLICE && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono agenti disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
- }
- case 118://medici
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo medico disponibile");
- PlayerInfo[playerid][pphoneservice]=118;
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_MEDICS && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono medici disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
- }
- case 555://taxy
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo tassista disponibile");
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_TAXY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono tassisti disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
- }
- case 222://pizzaboy
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo pizzaboy disponibile");
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_PIZZABOY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono pizzaboy disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
- }
- case 444://meccanico
- {
- SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo meccanico disponibile");
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_MECHANICIAN && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
- {
- calledid=x;
- break;
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono meccanici disponibili");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
- }
- case 404://traffico residuo
- {
- format(s,sizeof(s),"[SMS] 404: Traffico residuo %d$",PlayerInfo[playerid][pphonemoney]);
- SendClientMessage(playerid,COLOR_PHONESMS,s);
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- }
- if (PlayerInfo[playerid][pphonemoney]<PHONE_TALK_PRICE*2 && PlayerInfo[playerid][pphoneservice]==0)
- {
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
- SendClientMessage(playerid, COLOR_NO, "Non hai abbastanza soldi nel cellulare");
- return 1;
- }
- new actiontext[MAX_CHATBUBBLE_LENGTH+1];
- format(s,sizeof(s),"* %s prende il cellulare, digita il numero e lo mette all'orecchio *",PlayerInfo[playerid][pname]);
- SendRangedMessage(playerid,COLOR_ME,s);
- format(actiontext,MAX_CHATBUBBLE_LENGTH,"* prende il suo cellulare e lo mette all'orecchio *");
- SetPlayerChatBubble(playerid,actiontext,COLOR_BUBBLE,30.0,10000);
- if(calledid==-1)
- {
- for(new x=0;x<MAX_PLAYERS;x++)
- {
- if(IsPlayerConnected(x) && PlayerInfo[x][pphonenumber]==number)
- {
- calledid=x;
- break;
- }
- }
- }
- if(calledid==-1)
- {
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Il numero da lei chiamato e' inesistente");
- SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
- return 1;
- }
- else if(calledid==playerid) return SendClientMessage(playerid, COLOR_NO, "Non puoi chiamare te stesso");
- else if(PlayerInfo[calledid][pphonecallstatus]) return SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Numero occupato");
- SendClientMessage(playerid, COLOR_INFO, "Premi il tasto destro del mouse per riagganciare");
- SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] -- Attendere --");
- PlayerInfo[playerid][pphonecallstatus]=1;
- PlayerInfo[playerid][pphonecallwith]=calledid;
- PlayerInfo[calledid][pphonecallstatus]=2;
- PlayerInfo[calledid][pphonecallwith]=playerid;
- PlayerInfo[playerid][pphonecalltry]=0;
- SetTimerEx("PlayerPhoneTo",4000,false,"dd",playerid,calledid);
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment