else if((strcmp(cmd, "/cell", true) == 0) || (strcmp(cmd, "/c", true) == 0))
{
if(PlayerHasItem(playerid, ITEM_PHONE) == INVALID_ITEM_SLOT) {
SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: You need to buy a phone first.");
return 1;
}
if(gCalling[playerid][CELL_CALLTYPE] != 0) // player or system call
{
if(strcount(cmdtext, ' ') < 2)
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /cell [message]");
return 1;
}
idx++; // remove the space
strmid(string, cmdtext, idx, sizeof(string));
new text[255];
//new pn[24];
//new pn = GetUserName(playerid);
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(playerid), string);
SendLocalMessage(20.0, playerid, text, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
new targetid = gCalling[playerid][CELL_PLAYERID];
if(gCalling[playerid][CELL_CALLTYPE] == 1) //player call
{
if(!IsPlayerConnected(targetid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "* Line goes dead.");
StopCall(playerid);
return 1;
}
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(playerid), string);
SendLocalMessage(20.0, playerid, text, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
//non player number
SystemCall(playerid, targetid, string);
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(targetid), string);
SendClientMessage(playerid, COLOR_WHITE, text);
return 1;
}
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(targetid), string);
SendClientMessage(playerid, COLOR_WHITE, text);
if (IsPlayerInAnyVehicle(playerid)) SendFBIVanMessage(playerid, COLOR_FBI1,COLOR_FBI2,COLOR_FBI3,COLOR_FBI4,COLOR_FBI5, string, 40.0);
else SendFBIVanMessage(playerid, COLOR_FBI1,COLOR_FBI2,COLOR_FBI3,COLOR_FBI4,COLOR_FBI5, string, 60.0);
if (PlayerInfo[playerid][pWired] == 1) format(text,sizeof(text),"[WIRE][Cell] %s says: %s",PlayerInfo[playerid][pName],string), SendFBIMessage(NICESKY, text);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: You do not have a call.");
}
return 1;
}
if(gCalling[playerid][CELL_CALLTYPE] != 0) // player or system call
{
idx++; // remove the space
strmid(string, cmdtext, idx, sizeof(string));
new text[255];
//new pn[24];
//new pn = GetUserName(playerid);
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(playerid), string);
SendLocalMessage(20.0, playerid, text, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
new targetid = gCalling[playerid][CELL_PLAYERID];
if(gCalling[playerid][CELL_CALLTYPE] == 1) //player call
{
if(!IsPlayerConnected(targetid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "* Line goes dead.");
StopCall(playerid);
return 1;
}
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(playerid), string);
SendLocalMessage(20.0, playerid, text, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
//non player number
SystemCall(playerid, targetid, string);
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(targetid), string);
SendClientMessage(playerid, COLOR_WHITE, text);
return 1;
}
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(targetid), string);
SendClientMessage(playerid, COLOR_WHITE, text);
if (IsPlayerInAnyVehicle(playerid)) SendFBIVanMessage(playerid, COLOR_FBI1,COLOR_FBI2,COLOR_FBI3,COLOR_FBI4,COLOR_FBI5, string, 40.0);
else SendFBIVanMessage(playerid, COLOR_FBI1,COLOR_FBI2,COLOR_FBI3,COLOR_FBI4,COLOR_FBI5, string, 60.0);
if (PlayerInfo[playerid][pWired] == 1) format(text,sizeof(text),"[WIRE][Cell] %s says: %s",PlayerInfo[playerid][pName],string), SendFBIMessage(NICESKY, text);
}
return 1;
}
C:\Documents and Settings\Admin\Desktop\SA-MP\GameMode\Aria v2 31-1-10 Final.pwn(3914) : warning 225: unreachable code C:\Documents and Settings\Admin\Desktop\SA-MP\GameMode\Aria v2 31-1-10 Final.pwn(3916) : error 017: undefined symbol "idx" C:\Documents and Settings\Admin\Desktop\SA-MP\GameMode\Aria v2 31-1-10 Final.pwn(3916) : warning 215: expression has no effect C:\Documents and Settings\Admin\Desktop\SA-MP\GameMode\Aria v2 31-1-10 Final.pwn(3917) : error 017: undefined symbol "cmdtext" C:\Documents and Settings\Admin\Desktop\SA-MP\GameMode\Aria v2 31-1-10 Final.pwn(3917) : error 035: argument type mismatch (argument 2) C:\Documents and Settings\Admin\Desktop\SA-MP\GameMode\Aria v2 31-1-10 Final.pwn(3919) : warning 219: local variable "text" shadows a variable at a preceding level
strmid(string, cmdtext, idx, sizeof(string));
Originally Posted by CJ101
It goes in OnPlayerCommandText, not OnPlayerText.
|
Originally Posted by UberSocks
The point of this function is to replace the need for the use of /c to talk over a cellphone when a player is on a call. Below I've posted the original code, and the code I've formatted for use under OnPlayerText.
|
Originally Posted by Chuck_Taylor
The second one is that you need right?
|
b) Do not bump Some people apparently think they are important enough to bump their own topic after 10 minutes. You can bump topics when the last reply is at least 12 hours old. |
idx++; // remove the space
strmid(string, cmdtext, idx, sizeof(string));
new text[255];
//new pn[24];
//new pn = GetUserName(playerid);
format(text, sizeof(text), "%s (cellphone): %s", GetUserName(playerid), string);
SendLocalMessage(20.0, playerid, text, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
new msg[255];
//new pn[24];
//new pn = GetUserName(playerid);
format(msg, sizeof(msg), "%s (cellphone): %s", GetUserName(playerid), text);
SendLocalMessage(20.0, playerid, msg, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);