Hallo Zusammen,
ich hätte gerne das Smartphone von Silex(V.3.4) in der 5.0, allerdings funktioniert dieses ja noch mit der life_fnc_mp.
Nun habe ich die Funktion einfach nach dem Tutorial von Blackfish umgeschrieben, allerdings wird dann die Nachricht nicht ausgegeben.
Sobald ich eine Nachricht abschicke kommt nur die vorgefertigte Zeile von der fn_newMsg.sqf aber nicht die eigentliche Nachricht.
Syntax Fehler oder andere offensichtliche Fehler gibt es weder Ingame, noch in den RTP logs.
Hier die "kaputten" Dateien:
Mission:
Code: fn_newMsg.sqf
#include "..\..\script_macros.hpp"
/*
file: fn_newMsg.sqf
Author: Silex
*/
...Code...
switch(_type) do
{
case 0:
{
life_smartphoneTarget = call compile format["%1",_playerData];
ctrlSetText[88886, format["Nachricht an: %1",name life_smartphoneTarget]];
if(FETCH_CONST(life_adminlevel) < 1) then
{
ctrlShow[888897,false];
};
};
//normal message
case 1:
{
if(isNUll life_smartphoneTarget) exitWith {hintSilent format["Keine Person ausgwaehlt!"];};
ctrlShow[88885, false];
if(_msg == "") exitWith {hintSilent "Du must eine Nachricht zum Senden schreiben!";ctrlShow[88885, true];};
[life_smartphoneTarget,_msg,player,0] remoteExec ["TON_fnc_handleMessages",0];
hintSilent format["Du hast %1 eine Nachricht gesendet: %2",name life_smartphoneTarget,_msg];
ctrlShow[88885, true];
closeDialog 88883;
};
//copmessage
case 2:
{
if(({side _x == west} count allPlayers) == 0) exitWith {hintSilent format["Die Polizei ist derzeit nicht zu erreichen. Bitte versuchen Sie es nachher nochmal."];};
ctrlShow[888895,false];
if(_msg == "") exitWith {hintSilent "Du must eine Nachricht zum Senden schreiben!";ctrlShow[888895,true];};
[ObjNull,_msg,player,1] remoteExec ["TON_fnc_handleMessages",0];
_to = "Polizei";
hintSilent format["Du hast %1 eine Nachricht gesendet: %2",_to,_msg];
ctrlShow[888895,true];
closeDialog 887890;
};
//msgadmin
case 3:
{
ctrlShow[888896,false];
if(_msg == "") exitWith {hintSilent "Du must eine Nachricht zum Senden schreiben!";ctrlShow[888896,true];};
[ObjNull,_msg,player,2] remoteExec ["TON_fnc_handleMessages",0];
_to = "The Admins";
hintSilent format["Du hast %1 eine Nachricht gesendet: %2",_to,_msg];
ctrlShow[888896,true];
closeDialog 887890;
};
...weitere Nachrichtenarten...
//adminMsgAll
case 7:
{
if(FETCH_CONST(life_adminlevel) < 1) exitWith {hintSilent "Du bist kein Admin!";};
if(_msg == "") exitWith {hintSilent "Du must eine Nachricht zum Senden schreiben!";};
[ObjNull,_msg,player,5] remoteExec ["TON_fnc_handleMessages",0];
hintSilent format["Adminnachricht gesendet an Alle:",_msg];
closeDialog 887890;
};
//adacrequest
case 8:
{
if(({side _x == independent} count allPlayers) == 0) exitWith {hintSilent format["Zurzeit ist kein ADAC im Dienst. Bitte probiere es nachher nochmal."];};
ctrlShow[888900,false];
if(_msg == "") exitWith {hintSilent "Du must eine Nachricht zum Senden schreiben!";ctrlShow[888900,true];};
[ObjNull,_msg,player,6] remoteExec ["TON_fnc_handleMessages",0];
hintSilent format["Notruf an den ADAC wurde abgesetzt.",_msg];
ctrlShow[888900,true];
closeDialog 887890;
};
};
Alles anzeigen
life_server
Code: handleMessages.sqf
/*
file: fn_handleMessages.sqf
Author: Silex modified by cat24max
Übersetzt von Tim "cat24max" Vogler
http://republik-altis.de/
*/
private["_msg","_to","_target","_player","_type"];
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
_msg = [_this,1,"",[""]] call BIS_fnc_param;
_player = [_this,2,ObjNull,[ObjNull]] call BIS_fnc_param;
_type = [_this,3,-1] call BIS_fnc_param;
switch(_type) do
{
//normal message
case 0:
{
if(isNULL _target) exitWith {};
_to = call compile format["%1", _target];
[_msg,name _player,0] remoteExec ["TON_fnc_clientMessage",_to];
private["_query","_pid","_toID"];
_pid = getPlayerUID _player;
_toID = getPlayerUID _target;
_msg = [_msg] call DB_fnc_mresString;
_fromName = name _player;
_toName = name _target;
_query = format["INSERT INTO messages (fromID, toID, message, fromName, toName) VALUES('%1', '%2', '""%3""', '%4', '%5')",_pid,_toID,_msg,_fromName,_toName];
diag_log format["Query: %1",_query];
waitUntil{!DB_Async_Active};
[_query,1] call DB_fnc_asyncCall;
};
//message to cops
case 1:
{
[_msg,name _player,1] remoteExec ["TON_fnc_clientMessage",west];
};
//to admins
case 2:
{
[_msg,name _player,2] remoteExec ["TON_fnc_clientMessage",0];
};
//ems request
case 3:
{
[_msg,name _player,5] remoteExec ["TON_fnc_clientMessage",independent];
};
//adminToPerson
case 4:
{
_to = call compile format["%1", _target];
if(isNull _to) exitWith {};
[_msg,name _player,3] remoteExec ["TON_fnc_clientMessage",_to];
};
//adminMsgAll
case 5:
{
[_msg,name _player,4] remoteExec ["TON_fnc_clientMessage",0];
};
//ADAC request
case 6:
{
[_msg,name _player,5] remoteExec ["TON_fnc_clientMessage",independent];
};
//Cop To All
case 7:
{
[_msg,name _player,4] remoteExec ["TON_fnc_clientMessage",0]
};
};
Alles anzeigen
Code: functions.sqf
...Mehr Code...
TON_fnc_clientMessage =
compileFinal "
if (isServer) exitWith {};
private [""_msg"",""_from"", ""_type""];
_msg = _this select 0;
_from = _this select 1;
_type = _this select 2;
if (_from isEqualTo """") exitWith {};
switch (_type) do {
case 0 : {
private [""_message""];
_message = format ["">>>MESSAGE FROM %1: %2"",_from,_msg];
hint parseText format [""<t color='#FFCC00'><t size='2'><t align='center'>New Message<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>You<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%2"",_from,_msg];
[""TextMessage"",[format [""You Received A New Private Message From %1"",_from]]] call bis_fnc_showNotification;
systemChat _message;
};
case 1 : {
if (side player != west) exitWith {};
private [""_message"",""_loc"",""_unit""];
_loc = _this select 3;
_unit = _this select 4;
_message = format [""--- 911 DISPATCH FROM %1: %2"",_from,_msg];
if (isNil ""_loc"") then {_loc = ""Unknown"";};
hint parseText format [""<t color='#316dff'><t size='2'><t align='center'>New Dispatch<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>All Officers<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><t color='#33CC33'>Coords: <t color='#ffffff'>%2<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%3"",_from,_loc,_msg];
[""PoliceDispatch"",[format [""A New Police Report From: %1"",_from]]] call bis_fnc_showNotification;
systemChat _message;
};
case 2 : {
if ((call life_adminlevel) < 1) exitWith {};
private [""_message"",""_loc"",""_unit""];
_loc = _this select 3;
_unit = _this select 4;
_message = format [""!!! ADMIN REQUEST FROM %1: %2"",_from,_msg];
if (isNil ""_loc"") then {_loc = ""Unknown"";};
hint parseText format [""<t color='#ffcefe'><t size='2'><t align='center'>Admin Request<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>Admins<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><t color='#33CC33'>Coords: <t color='#ffffff'>%2<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%3"",_from,_loc,_msg];
[""AdminDispatch"",[format [""%1 Has Requested An Admin!"",_from]]] call bis_fnc_showNotification;
systemChat _message;
};
case 3 : {
private [""_message""];
_message = format [""!!! ADMIN MESSAGE: %1"",_msg];
_admin = format [""Sent by admin: %1"", _from];
hint parseText format [""<t color='#FF0000'><t size='2'><t align='center'>Admin Message<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>You<br/><t color='#33CC33'>From: <t color='#ffffff'>An Admin<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1"",_msg];
[""AdminMessage"",[""You Have Received A Message From An Admin!""]] call bis_fnc_showNotification;
systemChat _message;
if ((call life_adminlevel) > 0) then {systemChat _admin;};
};
case 4 : {
private [""_message"",""_admin""];
_message = format [""!!!ADMIN MESSAGE: %1"",_msg];
_admin = format [""Sent by admin: %1"", _from];
hint parseText format [""<t color='#FF0000'><t size='2'><t align='center'>Admin Message<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>All Players<br/><t color='#33CC33'>From: <t color='#ffffff'>The Admins<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1"",_msg];
...weitere Nachrichtenarten...
publicVariable "TON_fnc_clientMessage";
...Mehr Code..
Alles anzeigen
Hoffe einer von euch kennt sich mit dieser bescheuerten remoteExec besser aus und kann mir helfen.