Moin.
Kurz und knapp: ich habe ein SMS System in MySQL geschrieben und die SMSen werden nur an ID 0 gesendet...
Code:
ocmd:sms(playerid,params[])
{
new number,targetid,target[256],player[MAX_PLAYER_NAME],string[256],text[64];
if(!PhoneState[playerid])return SendClientMessage(playerid,COLOR_RED,"Dein Handy ist ausgeschaltet!");
if(sscanf(params,"is",number,text))return SendClientMessage(playerid,0xFFA300FF,"Benutzung: /sms <Telefonnummer> <Text>");
if(GetPlayerMoney(playerid) <= 5)return SendClientMessage(playerid,COLOR_RED,"Dein Guthaben ist leer, du kannst keine SMS mehr versenden!");
target = mysql_GetStringI("phoneinfos","name","number",number);
targetid = GetPlayerID(target);
GetPlayerName(playerid,player,sizeof(player));
GetPlayerName(targetid,target,sizeof(target));
new Float:xm, Float:ym, Float:zm,maxplayers=GetMaxPlayers();
if(GetPlayerPos(playerid,xm,ym,zm))
{
for(new i=0;i<maxplayers;i++){
if(IsPlayerConnected(i) && (i==playerid || IsPlayerInRangeOfPoint(i,20,xm,ym,zm))) {
new name[MAX_PLAYER_NAME],str[256];
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"* %s nimmt sein Handy raus.",name);
SendClientMessage(i,0xC2A2DAFF,str);
}
}
}
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid,COLOR_RED,"Senden der Nachricht fehlgeschlagen!");
if(!PhoneState[targetid])return SendClientMessage(playerid,COLOR_RED,"Dieser Spieler hat sein Handy ausgeschaltet!");
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
GivePlayerMoney(playerid,-5);
format(string,sizeof(string),"SMS: %s, Empfänger: %s (%i)",text,target,number);
SendClientMessage(playerid,0xFFFF00FF,string);
format(string,sizeof(string),"SMS: %s, Absender: %s (%i)",text,player,mysql_GetInt("phoneinfos","number","name",player));
SendClientMessage(targetid,0xFFFF00FF,string);
printf("[sms] %s (%s -> %s)",text,player,target);
return 1;
}
[14:28:24] [chat] [Gredsoft]: Schreib Marti mal eine SMS (/sms 8112 Blabla)[14:28:31] [sms] test (Timo_Sacred -> Gredsoft)[14:28:35] [chat] [Timo_Sacred]: geklappt
Screen:
(Yeah, Telefonnummer 1337 ftw o.O)
Grüße
Gredsoft
(Struktur der Tabelle 'phoneinfos': name - number)