Need help with my Cellphone System, PLEASE. -
Код:
public OnPlayerText(playerid, text[])
{
if(ICChat)
{
new
pName[MAX_PLAYER_NAME],
string [256];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s says: %s", pName, text);
ProxDetector(20.0, playerid, string, White, White, White, White, White);
return 0;
}
if(Mobile[playerid] != 255)
{
new
pName[MAX_PLAYER_NAME],
string [256];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s Says (CellPhone): %s", pName, text);
ProxDetector(20.0, playerid, string, White, White, White, White, White);
return 0;
}
return 1;
}
//---------<[Cellphone System]>-----------
dcmd_call(playerid, params[])
{
new
pName[MAX_PLAYER_NAME],
CallerName[MAX_PLAYER_NAME],
string [256],
giveplayerid,
pNumber;
GetPlayerName(playerid, pName, sizeof(pName));
if(sscanf(params, "i", pNumber)) return SendClientMessage(playerid, White, "USAGE: /©all [Number]");
if(PlayerInfo[playerid][PhoneNumber] == 0) SendClientMessage(playerid, White, "You do not have a cellphone");
else
{
format(string, sizeof(string), "%s takes out their cellphone.", pName);
ProxDetector(30.0, playerid, string, Purple, Purple, Purple, Purple, Purple);
printf("%s", string);
if(pNumber == PlayerInfo[playerid][PhoneNumber])
{
SendClientMessage(playerid, White, "You just got a busy tone...");
return 1;
}
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, White, "You're already on a call...");
return 1;
}
if(Calling[playerid] != 255)
{
SendClientMessage(playerid, White, "Your phone is ringing...");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][PhoneNumber] == pNumber && pNumber != 0)
{
giveplayerid = i;
Calling[playerid] = giveplayerid;
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(Mobile[giveplayerid] == 255)
{
format(string, sizeof(string), "Your Cellphone is ringing.. (Type /Pickup) CallerID: %s", CallerName);
SendClientMessage(giveplayerid, Yellow, string);
GetPlayerName(giveplayerid, CallerName, sizeof(CallerName));
format(string, sizeof(string), "* %s's phone begins to ring..", CallerName);
SendClientMessage(playerid, White, "HINT: You can now use T to talk on your phone. (Type /Hangup to end the call)");
ProxDetector(30.0, i, string, Purple, Purple, Purple, Purple, Purple);
}
}
}
}
}
}
}
return 1;
}
dcmd_pickup(playerid, params[])
{
#pragma unused params
new
CallerName[MAX_PLAYER_NAME],
string [256];
if(IsPlayerConnected(playerid))
{
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, White, " You are already on a call...");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Calling[i] == playerid)
{
Calling[i] = 255;
Mobile[playerid] = i;
SendClientMessage(i, White, "They picked up the call");
GetPlayerName(playerid, CallerName, sizeof(CallerName));
format(string, sizeof(string), "* %s answers his cellphone.", CallerName);
ProxDetector(30.0, playerid, string, Purple, Purple, Purple, Purple, Purple);
}
}
}
}
return 1;
}
I can call the number, and the player can pickup without any problem. The only problem is that when we try to talk to each other, he can't see what I'm saying, and it doesn't even say... *YourName* (CellPhone): *Text*
Re: Need help with my Cellphone System, PLEASE. -
Re: Need help with my Cellphone System, PLEASE. -
Re: Need help with my Cellphone System, PLEASE. -