SA-MP Forums Archive
SAMP-SERVER closes - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SAMP-SERVER closes (/showthread.php?tid=663077)



SAMP-SERVER closes - Jaua10 - 21.01.2019

Hello guys I'm trying to make a roleplay server from 0 and everything was fine but now when i was thinking in in create two new commands (/report id reason) and (/request text) but when i type any of this commands, the samp-server downs and restart the server always and never get online again, of course unless i run the samp server again, im not sure if i made the cmds in the right way but this is my code:

PHP Code:
CMD:report(playerid, params[]) return cmd_reportar(playerid, params);
CMD:reportar(playerid, params[])
{
    new 
id;
    new 
reason[128];
    if(
sscanf(params, "us[128]", id, reason)) return SendLanguageMessage(playerid, -1, "USAGE: {0092FF}/report [PlayerID / PartOfName] [Reason]", "USO: {0092FF}/reportar [PlayerID / PartOfName] [Razon]");
    new 
string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, sender, sizeof(sender));
    
GetPlayerName(id, receiver, sizeof(receiver));
    
format(string, sizeof(string), "Report from %s (ID: %d) has reported %s (ID: %d)", "Reporte de %s (ID: %d) a reportado a %s (ID: %d)", sender, playerid, receiver, id);
    
SendMessageToAdmins(string);
    
format(string, sizeof(string), "Reason: %s", "Razon: %s", reason);
    
SendMessageToAdmins(string);
    
SendLanguageMessage(playerid, COLOR_YELLOW, "Your report message was sent to the Admins.", "Tu mensaje de reporte ha sido enviado a los Administradores.");
    return 
1;
}
stock SendMessageToAdmins(text[])
{
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(
IsPlayerAdmin(i))
        {
            
SendClientMessage(i, COLOR_RED, text);
        }
    }
}
CMD:request(playerid, params[]) return cmd_solicitud(playerid, params);
CMD:solicitud(playerid, params[])
{
    new 
id;
    new 
request[128];
    if(
sscanf(params, "us[128]", id, request)) return SendLanguageMessage(playerid, -1, "USAGE: {0092FF}/request [Text]", "USO: {0092FF}/solicitud [Texto]");
    new 
string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, sender, sizeof(sender));
    
GetPlayerName(id, receiver, sizeof(receiver));
    
format(string, sizeof(string), "Request from %s (ID: %d): %s ", "Solicitud de %s (ID: %d): %s", sender, playerid, request);
    
SendMessageToAdmins(string);
    
SendLanguageMessage(playerid, COLOR_YELLOW, "Your request message was sent to the Admins. Please be patient and wait for a reply.", "Tu mensaje de solicitud ha sido enviado a los Administradores. Por Favor sea paciente y espere una respuesta.");
    return 
1;
} 
I really appreciate it if u give me a hand with this. Thanks in advance


Re: SAMP-SERVER closes - Jaua10 - 21.01.2019

by the way my server is multilanguage


Re: SAMP-SERVER closes - Jaua10 - 21.01.2019

Quote:
Originally Posted by Y_Less
View Post
Have you tried crashdetect? Also, you can’t use format like that. I suggest you look at y_languages if your server is multi-lingual.
yes i use it and its normal..there are no errors, uhm...alright thanks for the suggestion


Re: SAMP-SERVER closes - Spoookymon - 21.01.2019

It's format.
format(string, sizeof(string), "Report from %s (ID: %d) has reported %s (ID: %d)", "Reporte de %s (ID: %d) a reportado a %s (ID: %d)", sender, playerid, receiver, id);

Also, in sscanf use "r" - "rs[128]"


Re: SAMP-SERVER closes - Spoookymon - 21.01.2019

Quote:
Originally Posted by Y_Less
View Post
`u` and `r` are different, but both valid.
Yes, `u` supports npc and `r` does not.
Off topic: is `r` a bit faster/slower or the same ?


Re: SAMP-SERVER closes - Jaua10 - 21.01.2019

Quote:
Originally Posted by Spoookymon
View Post
It's format.
format(string, sizeof(string), "Report from %s (ID: %d) has reported %s (ID: %d)", "Reporte de %s (ID: %d) a reportado a %s (ID: %d)", sender, playerid, receiver, id);

Also, in sscanf use "r" - "rs[128]"
i JUST NEED TO REEMPLACE MI CODE WITH THIS?


Re: SAMP-SERVER closes - Spoookymon - 21.01.2019

Quote:
Originally Posted by Jaua10
View Post
i JUST NEED TO REEMPLACE MI CODE WITH THIS?
No, seperate this into two format's.

format(string, sizeof(string), "Report from %s (ID: %d) has reported %s (ID: %d)", sender, playerid, receiver, id);

and

format(string, sizeof(string), "Reporte de %s (ID: %d) a reportado a %s (ID: %d)", sender, playerid, receiver, id);

ofc, you have to check which language user uses, or use y_languages as Y_Less said

if( plang[ playerid ] == ENG ) format(string, sizeof(string), "Report from %s (ID: %d) has reported %s (ID: %d)", sender, playerid, receiver, id);
else format(string, sizeof(string), "Reporte de %s (ID: %d) a reportado a %s (ID: %d)", sender, playerid, receiver, id);

OR

Code:
new stringEN[ 150 ], stringDE[ 150 ];
format(stringEN, sizeof(stringEN), "Report from %s (ID: %d) has reported %s (ID: %d)", sender, playerid, receiver, id);
format(stringDE, sizeof(stringDE), "Reporte de %s (ID: %d) a reportado a %s (ID: %d)", sender, playerid, receiver, id);



Re: SAMP-SERVER closes - Jaua10 - 21.01.2019

alright i got it, thank you all very much for your time!


Re: SAMP-SERVER closes - Jaua10 - 23.01.2019

Quote:
Originally Posted by Y_Less
View Post
Have you tried crashdetect? Also, you can’t use format like that. I suggest you look at y_languages if your server is multi-lingual.
Excuse me bro, Im needing this can u give the link please? im making a milti-lingual server but i cant find this y_languages, i'll appreciate it. Thanks in advance