Sorry i'm a noob with mysql
here's my code:
Код:
CMD:call(playerid, params[])
{
if(eingeloggt[playerid] == 0)return SendClientMessage(playerid, COLOR_RED, "Du bist noch nicht eingeloggt.");
if(pInfo[playerid][handy] == 0)return SendClientMessage(playerid, COLOR_RED, "Du hast kein Handy.");
if(GetPVarInt(playerid,"AusgehenderAnruf") == 1)return SendClientMessage(playerid, COLOR_RED, "Du rufst derzeit schon jemanden an.");
if(GetPVarInt(playerid,"Anruf") == 1)return SendClientMessage(playerid, COLOR_RED, "Du bist schon in einem Gesprдch.");
new Nummer;
if(sscanf(params,"i",Nummer))return SendClientMessage(playerid, COLOR_RED, "INFO: /call [Nummer]");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Nummer <= 9999)return SendClientMessage(playerid, COLOR_RED, "Ungьltige Nummer.");
if(Nummer == GetPlayerNumber(playerid))return SendClientMessage(playerid, COLOR_RED, "Du kannst dich nicht selber anrufen.");
if(Nummer == GetPlayerNumber(i))
{
if(GetPVarInt(i,"Anruf") == 1)return SendClientMessage(playerid, COLOR_RED, "Der Spieler ist schon in einem Anruf.");
SetPVarInt(playerid,"AusgehenderAnruf",1);
SetPVarInt(playerid,"CallerID",i);
SetPVarInt(i,"CallerID",playerid);
SetPVarInt(i,"EingehenderAnruf",1);
SendFormatMessage(i,COLOR_YELLOW,"Eingehender Anruf von der Nummer: %i",pInfo[playerid][nummer]);
SendClientMessage(i, COLOR_YELLOW,"Benutze /acceptcall um den Anruf anzunehmen.");
SendClientMessage(playerid, COLOR_YELLOW, "Das Handy von der Nummer klingelt, bitte warten.");
CallCheckTimer[playerid] = SetTimerEx("CallCheck",1000,true,"i",playerid);
return 1;
}
}
return 1;
}
Код:
stock GetPlayerNumber(playerid)
{
if(pInfo[playerid][handy] == 0)return 0;
return pInfo[playerid][nummer];
}
It only checks the online players, the number is stored in the player data.
And it checks it and if it is equal to an other number that has an online player, it try's another.
But doesn't check offline players.