if(strcmp(cmd, "/hangup", true) == 0 || strcmp(cmd, "/h", true) == 0) { if(IsPlayerConnected(playerid)) { new caller = Mobile[playerid]; if(IsPlayerConnected(caller)) { if(caller != INVALID_PLAYER_ID) { if(caller != 255) { if(caller < 255) { SendClientMessage(caller, COLOR_GRAD2, " Prekinuo je."); CellTime[caller] = 0; CellTime[playerid] = 0; SendClientMessage(playerid, COLOR_GRAD2, " Prekinuli ste."); Mobile[caller] = 255; } Mobile[playerid] = 255; CellTime[playerid] = 0; RingTone[playerid] = 0; PlayerInfo[playerid][pSpeaker] = 0; UnidentifedCall[playerid] = 0; } } } SendClientMessage(playerid, COLOR_GRAD2, " Telefon vam je u dzepu."); SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE); RemovePlayerAttachedObject(playerid, 4); TextDrawHideForPlayer(playerid, Text0); TextDrawHideForPlayer(playerid, Text1); TextDrawHideForPlayer(playerid, Text2); TextDrawHideForPlayer(playerid, Text3); TextDrawHideForPlayer(playerid, Text4); TextDrawHideForPlayer(playerid, Text5); TextDrawHideForPlayer(playerid, Text6); TextDrawHideForPlayer(playerid, Text7); TextDrawHideForPlayer(playerid, Text8); TextDrawHideForPlayer(playerid, Text9); TextDrawHideForPlayer(playerid, Text10); TextDrawHideForPlayer(playerid, Text11); TextDrawHideForPlayer(playerid, Text12); TextDrawHideForPlayer(playerid, Text13); TextDrawHideForPlayer(playerid, Text14); TextDrawHideForPlayer(playerid, Text15); TextDrawHideForPlayer(playerid, Text16); TextDrawHideForPlayer(playerid, Text17); TextDrawHideForPlayer(playerid, Text18); TextDrawHideForPlayer(playerid, Text19); TextDrawHideForPlayer(playerid, Text20); TextDrawHideForPlayer(playerid, Text21); TextDrawHideForPlayer(playerid, Text22); TextDrawHideForPlayer(playerid, Text23); TextDrawHideForPlayer(playerid, Text24); TextDrawHideForPlayer(playerid, Text25); TextDrawHideForPlayer(playerid, Text26); TextDrawHideForPlayer(playerid, Text27); TextDrawHideForPlayer(playerid, Text28); TextDrawHideForPlayer(playerid, Text29); TextDrawHideForPlayer(playerid, Text30); TextDrawHideForPlayer(playerid, Text31); TextDrawHideForPlayer(playerid, Text32); TextDrawHideForPlayer(playerid, Text33); TextDrawHideForPlayer(playerid, Text34); TextDrawHideForPlayer(playerid, Text35); TextDrawHideForPlayer(playerid, Text36); TextDrawHideForPlayer(playerid, Text37); TextDrawHideForPlayer(playerid, Text38); TextDrawHideForPlayer(playerid, Text39); TextDrawHideForPlayer(playerid, Text40); TextDrawHideForPlayer(playerid, Text41); TextDrawHideForPlayer(playerid, Text42); TextDrawHideForPlayer(playerid, Text43); TextDrawHideForPlayer(playerid, Text44); TextDrawHideForPlayer(playerid, Text45); TextDrawHideForPlayer(playerid, Text46); TextDrawHideForPlayer(playerid, Text47); TextDrawHideForPlayer(playerid, Text48); TextDrawHideForPlayer(playerid, Text49); } return 1; }
if(strcmp(cmd, "/pickup", true) == 0 || strcmp(cmd, "/p", true) == 0) { if(IsPlayerConnected(playerid)) { if(Mobile[playerid] != 255) { SendClientMessage(playerid, COLOR_GRAD2, " Vec pricate sa nekim..."); return 1; } foreach (Player, i) { if(Mobile[i] == playerid) { Mobile[playerid] = i; //caller connecting SendClientMessage(i, COLOR_GRAD2, " Javio/Javila se."); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s se javio na mobitel.", sendername); SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE); SetPlayerAttachedObject(playerid, 4, 18866, 6, 0.0836, 0.0139, 0.0120, 260.6226, 355.9293, 160.3545, 1.0000, 1.0000, 1.0000); TextDrawShowForPlayer(playerid, Text0); TextDrawShowForPlayer(playerid, Text1); TextDrawShowForPlayer(playerid, Text2); TextDrawShowForPlayer(playerid, Text3); TextDrawShowForPlayer(playerid, Text4); TextDrawShowForPlayer(playerid, Text5); TextDrawShowForPlayer(playerid, Text6); TextDrawShowForPlayer(playerid, Text7); TextDrawShowForPlayer(playerid, Text8); TextDrawShowForPlayer(playerid, Text9); TextDrawShowForPlayer(playerid, Text10); TextDrawShowForPlayer(playerid, Text11); TextDrawShowForPlayer(playerid, Text12); TextDrawShowForPlayer(playerid, Text13); TextDrawShowForPlayer(playerid, Text14); TextDrawShowForPlayer(playerid, Text15); TextDrawShowForPlayer(playerid, Text16); TextDrawShowForPlayer(playerid, Text17); TextDrawShowForPlayer(playerid, Text18); TextDrawShowForPlayer(playerid, Text19); TextDrawShowForPlayer(playerid, Text20); TextDrawShowForPlayer(playerid, Text21); TextDrawShowForPlayer(playerid, Text22); TextDrawShowForPlayer(playerid, Text23); TextDrawShowForPlayer(playerid, Text24); TextDrawShowForPlayer(playerid, Text25); TextDrawShowForPlayer(playerid, Text26); TextDrawShowForPlayer(playerid, Text27); TextDrawShowForPlayer(playerid, Text28); TextDrawShowForPlayer(playerid, Text29); TextDrawShowForPlayer(playerid, Text30); TextDrawShowForPlayer(playerid, Text31); TextDrawShowForPlayer(playerid, Text32); TextDrawShowForPlayer(playerid, Text33); TextDrawShowForPlayer(playerid, Text34); TextDrawShowForPlayer(playerid, Text35); TextDrawShowForPlayer(playerid, Text36); TextDrawShowForPlayer(playerid, Text37); TextDrawShowForPlayer(playerid, Text38); TextDrawShowForPlayer(playerid, Text39); TextDrawShowForPlayer(playerid, Text40); TextDrawShowForPlayer(playerid, Text41); TextDrawShowForPlayer(playerid, Text42); TextDrawShowForPlayer(playerid, Text43); TextDrawShowForPlayer(playerid, Text44); TextDrawShowForPlayer(playerid, Text45); TextDrawShowForPlayer(playerid, Text46); TextDrawShowForPlayer(playerid, Text47); TextDrawShowForPlayer(playerid, Text48); TextDrawShowForPlayer(playerid, Text49); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); RingTone[playerid] = 0; } } } return 1; }
if(strcmp(cmd, "/call", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Koristite: /call [Broj]"); SendClientMessage(playerid, COLOR_GRAD2, "Koristite: /calllist (for a list for short numbers)"); return 1; } if(PlayerInfo[playerid][pPnumber] == 0) { SendClientMessage(playerid, COLOR_GRAD2, " Nemate telefon!"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s je uzeo mobitel iz dzepa.", sendername); SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE); SetPlayerAttachedObject(playerid, 4, 18866, 6, 0.0836, 0.0139, 0.0120, 260.6226, 355.9293, 160.3545, 1.0000, 1.0000, 1.0000); TextDrawShowForPlayer(playerid, Text0); TextDrawShowForPlayer(playerid, Text1); TextDrawShowForPlayer(playerid, Text2); TextDrawShowForPlayer(playerid, Text3); TextDrawShowForPlayer(playerid, Text4); TextDrawShowForPlayer(playerid, Text5); TextDrawShowForPlayer(playerid, Text6); TextDrawShowForPlayer(playerid, Text7); TextDrawShowForPlayer(playerid, Text8); TextDrawShowForPlayer(playerid, Text9); TextDrawShowForPlayer(playerid, Text10); TextDrawShowForPlayer(playerid, Text11); TextDrawShowForPlayer(playerid, Text12); TextDrawShowForPlayer(playerid, Text13); TextDrawShowForPlayer(playerid, Text14); TextDrawShowForPlayer(playerid, Text15); TextDrawShowForPlayer(playerid, Text16); TextDrawShowForPlayer(playerid, Text17); TextDrawShowForPlayer(playerid, Text18); TextDrawShowForPlayer(playerid, Text19); TextDrawShowForPlayer(playerid, Text20); TextDrawShowForPlayer(playerid, Text21); TextDrawShowForPlayer(playerid, Text22); TextDrawShowForPlayer(playerid, Text23); TextDrawShowForPlayer(playerid, Text24); TextDrawShowForPlayer(playerid, Text25); TextDrawShowForPlayer(playerid, Text26); TextDrawShowForPlayer(playerid, Text27); TextDrawShowForPlayer(playerid, Text28); TextDrawShowForPlayer(playerid, Text29); TextDrawShowForPlayer(playerid, Text30); TextDrawShowForPlayer(playerid, Text31); TextDrawShowForPlayer(playerid, Text32); TextDrawShowForPlayer(playerid, Text33); TextDrawShowForPlayer(playerid, Text34); TextDrawShowForPlayer(playerid, Text35); TextDrawShowForPlayer(playerid, Text36); TextDrawShowForPlayer(playerid, Text37); TextDrawShowForPlayer(playerid, Text38); TextDrawShowForPlayer(playerid, Text39); TextDrawShowForPlayer(playerid, Text40); TextDrawShowForPlayer(playerid, Text41); TextDrawShowForPlayer(playerid, Text42); TextDrawShowForPlayer(playerid, Text43); TextDrawShowForPlayer(playerid, Text44); TextDrawShowForPlayer(playerid, Text45); TextDrawShowForPlayer(playerid, Text46); TextDrawShowForPlayer(playerid, Text47); TextDrawShowForPlayer(playerid, Text48); TextDrawShowForPlayer(playerid, Text49); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); new phonenumb = strval(tmp); /*if(phonenumb == list) { SendClientMessage(playerid, COLOR_GREEN, "________________Lista Sluzbi________________"); SendClientMessage(playerid, COLOR_WHITE, "111 - picerija., 222 - bus sluzba"); SendClientMessage(playerid, COLOR_WHITE, "103 - bolnicari, 444 - taxi, 555 - mehanicar"); SendClientMessage(playerid, COLOR_GREEN, "____________________________________________"); return 1; }*/ if(phonenumb == 111) { new pizzaworkers = 0; foreach (Player, i) { if(PlayerInfo[i][pJob] == 17 && JobDuty[i] == 1) { pizzaworkers++; } } if(pizzaworkers < 1) { SendClientMessage(playerid, COLOR_GREY, " Javili su se."); SendClientMessage(playerid, 0xF4E19FAA, "Radnik (telefon): Halo, Picerija ovdje."); SendClientMessage(playerid, 0xF4E19FAA, "Radnik (telefon): Zao nam je, trenutno nemamo slobodnih raznosaca pica."); SendClientMessage(playerid, COLOR_GREY, " Prekinuli su."); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "** %s je narucio picu. (koristite /prihvati Pizza da prihvatite narudzbu)", sendername); SendJobMessage(17, COLOR_WHITE, string); SendClientMessage(playerid, COLOR_GREY, " Javili su se."); SendClientMessage(playerid, 0xF4E19DAA, "Radnik (telefon): Halo, Picerija ovdje."); if(pizzaworkers == 1) { format(string, sizeof(string), "Radnik (telefon): Gospodine, poslali smo jednog raznosaca da vam donese picu."); } else { format(string, sizeof(string), "Radnik (telefon): Trenutno imamo %d raznosaca pica na duznosti, svima je javljeno za vasu narudzbu !", pizzaworkers); } SendClientMessage(playerid, 0xF4E19DAA, string); SendClientMessage(playerid, COLOR_GREY, " Prekinuli su."); PizzaCall = playerid; return 1; } if(phonenumb == 222) { new routezonecheck = IsInBusrouteZone(playerid); new drivercount = 0; if (routezonecheck == 0) { for (new i=0; i<=MAX_PLAYERS; i++) { if (IsPlayerConnected(i) && BusrouteEast[i][0] != 0) drivercount++; } if (drivercount != 0) { format(string, sizeof(string), "Trenutno ima %d vozaca autobusa na istocnoj ruti. Sledeca stajanja:", drivercount); SendClientMessage(playerid, COLOR_WHITE, string); SendBusRoute(playerid, 0); } else SendClientMessage(playerid, COLOR_GREY, "Nema trenutno vozaca busa na istocnoj ruti."); } else if (routezonecheck == 1) { for (new i=0; i<=MAX_PLAYERS; i++) { if (IsPlayerConnected(i) && BusrouteWest[i][0] != 0) drivercount++; } if (drivercount != 0) { format(string, sizeof(string), "Trenutno ima %d vozaca autobusa na zapadnoj ruti. Sledeca stajanja:", drivercount); SendClientMessage(playerid, COLOR_WHITE, string); SendBusRoute(playerid, 1); } else SendClientMessage(playerid, COLOR_GREY, "Nema vozaca na zapadnoj ruti."); } else SendClientMessage(playerid, COLOR_GREY, "Trenutno nema vozaca autobusa."); return 1; } /*if(phonenumb == 103) { if(Medics < 1) { SendClientMessage(playerid, COLOR_GREY, " There are no Medics On Duty at the moment, try again later !"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "** %s is in need of a Medic. (use /accept medic to accept the call)", sendername); SendRadioMessage(4, TEAM_AZTECAS_COLOR, string); SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have called for a Medic, wait for a reply."); MedicCall = playerid; return 1; }*/ if(phonenumb == 444) { if(TaxiDrivers < 1) { SendClientMessage(playerid, COLOR_GREY, " Javili su se."); SendClientMessage(playerid, 0xF4E19FAA, "Dispacer (telefon): Taxi Kompanija ovjde.Izvinite ali trenutno nemamo slobodnih vozaca."); SendClientMessage(playerid, COLOR_GREY, " Prekinuli su."); return 1; } if(TransportDuty[playerid] > 0) { SendClientMessage(playerid, COLOR_GREY, " Ne mozete sada zvati taksi !"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "** %s-u treba taksi. (kucajte /prihvati taxi da prihvatite poziv)", sendername); SendFamilyMessage(10, TEAM_AZTECAS_COLOR, string); SendClientMessage(playerid, COLOR_GREY, " Prihvatili su poziv."); SendClientMessage(playerid, 0xF4E19FAA, "Dispacer (telefon): Svi taksisti su informisani o vasem pozivu."); SendClientMessage(playerid, COLOR_GREY, " Prekinuli su."); TaxiCall = playerid; return 1; } if(phonenumb == 555) { new mechanicworkers = 0; foreach (Player, i) { if(PlayerInfo[i][pJob] == 7 && JobDuty[i] == 1) { mechanicworkers++; } } if(mechanicworkers < 1) { SendClientMessage(playerid, COLOR_GREY, " Javili su se."); SendClientMessage(playerid, 0xBBE1F2AA, "Vlasnik (telefon): Zao nam je ali trenutno nemamo slobodnih automehanicara."); SendClientMessage(playerid, COLOR_GREY, " They hang up."); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "** %s-u treba automehanicar. (kucajte /prihvati mechanic da prihvatite poziv)", sendername); SendJobMessage(7, COLOR_WHITE, string); SendClientMessage(playerid, COLOR_GREY, " Prihvatili su poziv."); SendClientMessage(playerid, 0xBBE1F2AA, "Vlasnik (telefon): Svim mehanicarima je javljeno o vasem pozivu."); SendClientMessage(playerid, COLOR_GREY, " Prekinuli su."); MechanicCall = playerid; return 1; } if(phonenumb == 3900) { SendClientMessage(playerid, COLOR_GREEN, "CNN Studio: Molimo vas ostavite poruku poslije zvuka **beep**!"); SendClientMessage(playerid, COLOR_WHITE, "Beep!"); Mobile[playerid] = 3900; return 1; } if(phonenumb == 911) { SendClientMessage(playerid, COLOR_WHITE, "Podjsetnik: Sada koristite ~ ili T da pricate preko telefona, kucajte /hangup ili /h da prekinete"); SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Koja vam sluzba treba, policija ili hitna_pomoc? (kucajte policija ili hitna_pomoc)?"); Mobile[playerid] = 911; return 1; } if(phonenumb == PlayerInfo[playerid][pPnumber]) { SendClientMessage(playerid, COLOR_GRAD2, " Zauzeto je..."); return 1; } if(Mobile[playerid] != 255) { SendClientMessage(playerid, COLOR_GRAD2, " Vec zovete nekog..."); return 1; } foreach (Player, i) { if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0) { giveplayerid = i; Mobile[playerid] = giveplayerid; //caller connecting if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(PhoneOnline[giveplayerid] > 0) { SendClientMessage(playerid, COLOR_GREY, "Trenutni korisnik je nedostupan molimo nazovite kasnije..."); return 1; } if (Mobile[giveplayerid] == 255) { format(string, sizeof(string), "Zvoni vam mobite, kucajte (/pickup da se javite) Pozivatelj: %s", sendername); SendClientMessage(giveplayerid, COLOR_YELLOW, string); GetPlayerName(giveplayerid, sendername, sizeof(sendername)); RingTone[giveplayerid] = 10; format(string, sizeof(string), "* %s mobitel zvoni.", sendername); SendClientMessage(playerid, COLOR_WHITE, "Podjsetnik: Sada koristite ~ ili T da pricate preko telefona, kucajte /hangup ili /h da prekinete"); ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); CellTime[playerid] = 1; return 1; } } } } } SendClientMessage(playerid, COLOR_GRAD2, " Zauzeto je..."); } return 1; }
RemovePlayerAttachedObject(playerid, 4);
Check what will happen if you remove
pawn Код:
Tell us results. |
the mobile phone doesn't disappears... it stay in my hands all the time...
|
SetPlayerAttachedObject(playerid, 4, 18866, 6, 0.0836, 0.0139, 0.0120, 260.6226, 355.9293, 160.3545, 1.0000, 1.0000, 1.0000);
What if you as well as removing that line remove
pawn Код:
If that doesn't work, you will have to use timers :/ |
//after the animation
SetTimerEx("CellphoneDisapear", DISAPPEAR_TIME, false, "d", playerid);
//on top of the script
forward public CellphoneDisappear(playerid);
// where ever you want :D
public CellphoneDisappear(playerid)
{
RemovePlayerAttachedObject(playerid, 4);
return 1;//don't know if this is necessary
}
pawn Код:
|