03.05.2010, 11:31
My cell phone commands problem.
Why no have animations my cell phone here is my code Pickup
Here is Hangup
Here is cell
Code
Why no have animations my cell phone here is my code Pickup
Код:
if(strcmp(cmd, "/pickup", true) == 0 || strcmp(cmd, "/p", true) == 0) { if(IsPlayerConnected(playerid)) { if(Mobile[playerid] != 255) { SendClientMessage(playerid, COLOR_GRAD2, " You are already on a call..."); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(Mobile[i] == playerid) { Mobile[playerid] = i; //caller connecting SendClientMessage(i, COLOR_GRAD2, " They Picked up the call."); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s answers his cellphone.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); RingTone[playerid] = 0; } } } } return 1; }
Here is Hangup
Код:
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, " They hung up."); CellTime[caller] = 0; CellTime[playerid] = 0; SendClientMessage(playerid, COLOR_GRAD2, " You hung up."); Mobile[caller] = 255; } Mobile[playerid] = 255; CellTime[playerid] = 0; RingTone[playerid] = 0; return 1; } } } SendClientMessage(playerid, COLOR_GRAD2, " Your phone is in your pocket."); } return 1; }
Code
Код:
if(strcmp(cmd, "/call", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /call [phonenumber]"); return 1; } if(PlayerInfo[playerid][pPnumber] == 0) { SendClientMessage(playerid, COLOR_GRAD2, " You dont't have a cell phone !"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s takes out a cellphone.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); new phonenumb = strval(tmp); if(phonenumb == 911) { SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up"); SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Which Service Do You Require, Police or Fireman?"); Mobile[playerid] = 911; return 1; } if(phonenumb == PlayerInfo[playerid][pPnumber]) { SendClientMessage(playerid, COLOR_GRAD2, " You just get a busy tone..."); return 1; } if(Mobile[playerid] != 255) { SendClientMessage(playerid, COLOR_GRAD2, " You are already on a call..."); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(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, " That players Phone is Offline !"); return 1; } if (Mobile[giveplayerid] == 255) { format(string, sizeof(string), "Your Mobile is Ringing Type (/Pickup) CallerID: %s", sendername); SendClientMessage(giveplayerid, COLOR_YELLOW, string); GetPlayerName(giveplayerid, sendername, sizeof(sendername)); RingTone[giveplayerid] = 10; format(string, sizeof(string), "* %s's phone begins to ring.", sendername); SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up"); ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); CellTime[playerid] = 1; return 1; } } } } } } SendClientMessage(playerid, COLOR_GRAD2, " You just get a Busy tone..."); } return 1;