open.mp forum
[Pawn] Not sending an error message - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] Not sending an error message (/showthread.php?tid=1847)



Not sending an error message - Axitz - 2021-04-07

I have this problem when I use the other method, it does work but if I change it the way I wanted, it doesn't. Please help.?

This one does work.
PHP Code:
if(Vehicles[vehicleid][impounded] == 1) return SendClientMSG(playerid, COLOR_RED, "{ff6347}Error: Unable to spawn because it is impounded.");

This one doesn't work. No Idea why.
PHP Code:
if(Vehicles[vehicleid][impounded] == 1) return SendClientMSG(playerid, COLOR_RED, "{ff6347}Error: Unable to spawn %s (ID: %d) because it is impounded.",GetVehicleName(Vehicles[vehicleid][vrID]), vehicleid);



RE: Not sending an error message - Radical - 2021-04-07

post your SendClientMSG function.


RE: Not sending an error message - Axitz - 2021-04-07

(2021-04-07, 04:26 PM)Radical Wrote: post your SendClientMSG function.



PHP Code:
stock SendClientMSG(playerid, color, fstring[], {Float, _}:...) { ? ? #define BYTES_PER_CELL 4 ? ? // This is the number of parameters which are not variable that are passed ? ? // to this function (i.e. the number of named parameters). ? ? static const ? ? ? ? STATIC_ARGS = 3; ? ? // Get the number of variable arguments. ? ? new ? ? ? ? n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL; ? ? if (n) ? ? { ? ? ? ? new ? ? ? ? ? ? message[128], ? ? ? ? ? ? arg_start, ? ? ? ? ? ? arg_end; ? ? ? ? // Load the real address of the last static parameter. Do this by ? ? ? ? // loading the address of the last known static parameter and then ? ? ? ? // adding the value of [FRM]. ? ? ? ? #emit CONST.alt? ? ? ? fstring ? ? ? ? #emit LCTRL? ? ? ? ? 5 ? ? ? ? #emit ADD ? ? ? ? #emit STOR.S.pri? ? ? arg_start ? ? ? ? // Load the address of the last variable parameter. Do this by adding ? ? ? ? // the number of variable parameters on the value just loaded. ? ? ? ? #emit LOAD.S.alt? ? ? n ? ? ? ? #emit ADD ? ? ? ? #emit STOR.S.pri? ? ? arg_end ? ? ? ? // Push the variable arguments. This is done by loading the value of ? ? ? ? // each one in reverse order and pushing them. I'd love to be able to ? ? ? ? // rewrite this to use the values of pri and alt for comparison, ? ? ? ? // instead of having to constantly load and reload two variables. ? ? ? ? do ? ? ? ? { ? ? ? ? ? ? #emit LOAD.I ? ? ? ? ? ? #emit PUSH.pri ? ? ? ? ? ? arg_end -= BYTES_PER_CELL; ? ? ? ? ? ? #emit LOAD.S.pri? ? arg_end ? ? ? ? } ? ? ? ? while (arg_end > arg_start); ? ? ? ? // Push the static format parameters. ? ? ? ? #emit PUSH.S? ? ? ? fstring ? ? ? ? #emit PUSH.C? ? ? ? 128 ? ? ? ? #emit PUSH.ADR? ? ? ? message ? ? ? ? // Now push the number of arguments passed to format, including both ? ? ? ? // static and variable ones and call the function. ? ? ? ? n = BYTES_PER_CELL * 3; ? ? ? ? #emit PUSH.S? ? ? ? n ? ? ? ? #emit SYSREQ.C? ? ? ? format ? ? ? ? // Remove all data, including the return value, from the stack. ? ? ? ? n = BYTES_PER_CELL; ? ? ? ? #emit LCTRL? ? ? ? ? 4 ? ? ? ? #emit LOAD.S.alt? ? ? n ? ? ? ? #emit ADD ? ? ? ? #emit SCTRL? ? ? ? ? 4 ? ? ? ? return SendMessageToPlayer(playerid, color, message); ? ? ? ? //return print(message); ? ? } ? ? else ? ? { ? ? ? ? return SendMessageToPlayer(playerid, color, fstring); ? ? ? ? //return print(fstring); ? ? } }



RE: Not sending an error message - destiezk - 2021-04-07

Code:
#define SendClientMessageFormatted(%0,%1,%2,%3) do{new _string[128]; format(_string,sizeof(_string),%2,%3); SendClientMessage(%0,%1,_string);} while(FALSE) if(Vehicles[vehicleid][impounded] == 1) return SendClientMessageFormatted(playerid, COLOR_RED, "{ff6347}Error: Unable to spawn %s (ID: %d) because it is impounded.",GetVehicleName(Vehicles[vehicleid][vrID]), vehicleid);



Try this.


RE: Not sending an error message - Pinch - 2021-04-07

Believe me and just replace your code with this one if you have YSI included:



Code:
if(Vehicles[vehicleid][impounded] == 1) return va_SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: Unable to spawn %s (ID: %d) because it is impounded.",GetVehicleName(Vehicles[vehicleid][vrID]), vehicleid);



RE: Not sending an error message - Axitz - 2021-04-08

I don't use YSI.