08.04.2009, 19:32
NB! As always - this forum has fucked up the indentation !
Do you see something wrong in here?
I do:
All help will be appreciated!
Luxeon
pawn Код:
if(strcmp(cmd, "/call", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /call [number]");
if(Phone[playerid] != 0)
{
Called[playerid] = strval(tmp);
if(Phone[playerid] == Called[playerid] || strval(Phone[playerid]) == Called[playerid])
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cant call yourself !");
return 1;
}else{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(Phone[i] == Called[playerid] || strval(Phone[i]) == Called[playerid])
{
if(Answered[playerid] == 0 && Answered[i] == 0)
{
SendClientMessage(i, COLOR_WHITE, "Some one is calling you, type /answer to answer the call !");
format(Called[i], 24, "%d", Called[playerid]);
format(Called[playerid], 24, "%d", Called[playerid]);
return 1;
}else{
SendClientMessage(playerid, COLOR_WHITE, "You or the guy you are calling to is on phone.");
return 1;
}
}else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Phone user is offline, doesn't exist or has his phone turned off.!");
return 1;
}
}
}
}else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You do not have a phone !");
return 1;
}
return 1;
}
if (strcmp("/answer", cmdtext, true, 7) == 0)
{
if(Phone[playerid] != 0)
{
if(Called[playerid] != 0 || Answered[playerid] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(Called[i] == Called[playerid])
{
SendClientMessage(playerid, COLOR_YELLOW, "You have answered the call - the conversation has started.");
SendClientMessage(i, COLOR_YELLOW, "The guy you called to has answered teh call - the conversation has started.");
format(Answered[i], 24, "%d", Called[playerid]);
format(Answered[playerid], 24, "%d", Called[playerid]);
return 1;
}
}
}else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: No one is calling you, nothing to answer !");
}
}else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You do not have a phone !");
}
return 1;
}
if (strcmp("/hangup", cmdtext, true, 7) == 0)
{
if(Phone[playerid] != 0)
{
if(Answered[playerid] != 0)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(Answered[i] == Answered[playerid])
{
SendClientMessage(playerid, COLOR_YELLOW, "You have ended the call!");
SendClientMessage(i, COLOR_YELLOW, "Your partner has ended the call!");
Answered[i] = 0;
Answered[playerid] = 0;
Called[i] = 0;
Called[playerid] = 0;
return 1;
}
}
}else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are not on phone - nothing to hang up!");
}
}else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You do not have a phone !");
}
return 1;
}
I do:
- You can call yourself
- Anything else ?(just take a look at the code)
All help will be appreciated!
Luxeon