Server crash on /onduty command
#1

Hi! I have no idea what is the problem Server-log write this:

PHP код:
[19:10:42] [debugServer crashed while executing HardLifeRPG.amx
[19:10:42] [debugAMX backtrace:
[
19:10:42] [debug#0 native SendClientMessageToAll () [00471820] from samp-server.exe
[19:10:42] [debug#1 002b4668 in public OnPlayerCommandText (0x00000004, 0x01173278) from HardLifeRPG.amx
[19:10:42] [debugNative backtrace:
[
19:10:42] [debug#0 0049dc0c in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#1 007301c0 in ?? ()
[19:10:42] [debug#2 77ca2d00 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[19:10:42] [debug#3 77ca2d00 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[19:10:42] [debug#4 77ca2c0e in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[19:10:42] [debug#5 00498d56 in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#6 00498d78 in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#7 67e8046a in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#8 59000043 in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#9 247c83c3 in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#10 2277e004 in ?? () from C:\Users\Dani\Desktop\Ъj mappa\szerverek\HarfLifeRPG\Hard\samp-server.exe
[19:10:42] [debug#11 042474ff in ?? () 
when I write /onduty or /asduty

PHP код:
    if(strcmp(cmd"/onduty"true) == 0)
    {
            new 
asadmin[17];
               if(
IsAS(playerid))
                
asadmin "Adminsegйd";
            else if(
IsTulaj(playerid) && !IsScripter(playerid))
                
asadmin "Tulajdonos";
            else if(
PlayerInfo[playerid][pAdmin] == 2013)
                
asadmin "Tulajdonos";
            else if(
PlayerInfo[playerid][pAdmin] == 2014)
                
asadmin "Tulajdonos";
            else if(
PlayerInfo[playerid][pAdmin] == 1338)
                
asadmin "Főadmin";
            else if(
PlayerInfo[playerid][pAdmin] == 1337)
                
asadmin "SuperAdmin";
            else if(
PlayerInfo[playerid][pAdmin] == 1339)
                
asadmin "Admin Controller";
            else if(
PlayerInfo[playerid][pAdmin] == 9999)
                
asadmin "Scripter";
            else if(
PlayerInfo[playerid][pAdmin] == 9998)
                
asadmin "Rendszergazda";
            else
                
asadmin "Admin";
            foreach(
Jatekosok,x)
            if(!
Admin(playerid1)) return 1;
            if(
AdminDuty[playerid] == 0)
            
        {
            
SendClientMessageToAll(COLOR_LIGHTBLUE"{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin);
            
SendFormatMessageToAll(COLOR_LIGHTBLUE"‹‹ %s %s Szolgбlatba Lйpett! Ьzenйshez: /pm %d ›› ",AdminName(playerid),asadmin ,playerid);
            
SendClientMessageToAll(COLOR_LIGHTBLUE"{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin);
            
//SetPlayerAttachedObject(playerid,0,19078,1,0.320722,-0.067912,0.165151,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
             
SetPlayerColor(playeridCOLOR_DBLUE);
            
AdminDuty[playerid] = 1;
            
gBooc[playerid] = 1;
            
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            
Format(string,"%s %s SZOLGБLATBAN\nPM: /pm %d",PlayerName(playerid),asadmin ,playerid);
            
AdminDuty3D[playerid] = CreateDynamic3DTextLabel(stringCOLOR_PIROS0.00.00.540.0playeridINVALID_VEHICLE_ID0);
            
//Attach3DTextLabelToPlayer(AdminDuty3D[playerid], playerid, 0.0, 0.0, 0.5);
        
}
        else
        {
            
SendClientMessageToAll(COLOR_LIGHTBLUE"{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin);
            
SendFormatMessageToAll(COLOR_LIGHTBLUE"‹‹ %s Kilйpett a %s szolgбlatbуl! Ha kйrdйsed van, /report! ›› ",AdminName(playerid),asadmin);
            
SendClientMessageToAll(COLOR_LIGHTBLUE"{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin);
            
//RemovePlayerAttachedObject(playerid,0);
             //SetPlayerColor(playerid, COLOR_WHITE);
             
SetPlayerToTeamColor(playerid);
            
AdminDuty[playerid] = 0;
            
gBooc[playerid] = 0;
            
DestroyDynamic3DTextLabel(AdminDuty3D[playerid]);
        }
        return 
1;
    }
//-------------
    //AdminSegйd Duty
    
if(strcmp(cmd"/asduty"true) == 0)
    {
        if(!
IsOrokAS(playerid)) return 1;
        if(
AsDuty[playerid] == 0)
        {
            foreach(
Jatekosok,p)
            {
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== ");
                
SendFormatMessage(p,COLOR_YELLOW"‹‹ %s  Adminsegйdszolgбlatba lйpett, Ha segнtsйg kell /pm %d ›› ",AdminName(playerid), playerid);
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== ");
            }
             
SetPlayerColor(playeridCOLOR_YELLOW);
            
AsDuty[playerid] = 1;
            
gBooc[playerid] = 1;
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            
Format(string,"%s ADMINSEGЙD SZOLGБLATBAN\nPM: /pm %d",PlayerName(playerid),playerid);
            
AsDuty3D[playerid] = CreateDynamic3DTextLabel(stringCOLOR_YELLOW0.00.0, -0.660.0playeridINVALID_VEHICLE_ID0);
        }
        else
        {
            foreach(
Jatekosok,p)
            {
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== ");
                
SendFormatMessage(p,COLOR_YELLOW"‹‹ %s Kilйpett a szolgбlatbуl! Ha segнtsйg kell, /report! ›› ",AdminName(playerid));
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== ");
            }
             
SetPlayerToTeamColor(playerid);
            if(
IsTulaj(playerid)) { }  else {
            
Nevek[playerid] = 0;
            
ShowNames(playerid0);
            }
            
AsDuty[playerid] = 0;
            
gBooc[playerid] = 0;
            if(
IsValidDynamic3DTextLabel(AsDuty3D[playerid]))
                
DestroyDynamic3DTextLabel(AsDuty3D[playerid]);
        }
        return 
1;
    } 
Reply
#2

SendClientMessageToAll syntax is (color, message[])
You can't pass 3 or more arguments to it. Maybe you have redefined SendClientMessageToAll somewhere, so you should check that code first or at least give it to us

By the way, read the red warning message at official wiki https://sampwiki.blast.hk/wiki/SendClientMessageToAll, looks like your server chashes because of formating characters in your message string.

Pass already formated string to this function, it'll fix your errors.
Reply
#3

try this
PHP код:
if(strcmp(cmd"/onduty"true) == 0
    { 
            new 
asadmin[17]; 
               if(
IsAS(playerid)) 
                
asadmin "Adminsegйd"
            else if(
IsTulaj(playerid) && !IsScripter(playerid)) 
                
asadmin "Tulajdonos"
            else if(
PlayerInfo[playerid][pAdmin] == 2013
                
asadmin "Tulajdonos"
            else if(
PlayerInfo[playerid][pAdmin] == 2014
                
asadmin "Tulajdonos"
            else if(
PlayerInfo[playerid][pAdmin] == 1338
                
asadmin "Főadmin"
            else if(
PlayerInfo[playerid][pAdmin] == 1337
                
asadmin "SuperAdmin"
            else if(
PlayerInfo[playerid][pAdmin] == 1339
                
asadmin "Admin Controller"
            else if(
PlayerInfo[playerid][pAdmin] == 9999
                
asadmin "Scripter"
            else if(
PlayerInfo[playerid][pAdmin] == 9998
                
asadmin "Rendszergazda"
            else 
                
asadmin "Admin"
            foreach(
Jatekosok,x
            if(!
Admin(playerid1)) return 1
            if(
AdminDuty[playerid] == 0
             
        { 
           new 
sztrg[120];
            
format(sztrg,sizeof(sztrg), "{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin);
            
SendClientMessageToAll(COLOR_LIGHTBLUE,sztrg); 
           
format(sztrg,sizeof(sztrg)," ‹‹ %s %s Szolgбlatba Lйpett! Ьzenйshez: /pm %d ›› ",AdminName(playerid),asadmin ,playerid); 
            
SendClientMessageToAll(COLOR_LIGHTBLUE,sztrg); 
             
format(sztrg,sizeof(sztrg), "{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin); 
            
SendClientMessageToAll(COLOR_LIGHTBLUE,sztrg); 
            
//SetPlayerAttachedObject(playerid,0,19078,1,0.320722,-0.067912,0.165151,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000); 
             
SetPlayerColor(playeridCOLOR_DBLUE); 
            
AdminDuty[playerid] = 1
            
gBooc[playerid] = 1
             
            new 
Float:xFloat:yFloat:z
            
GetPlayerPos(playeridxyz); 
            
Format(string,"%s %s SZOLGБLATBAN\nPM: /pm %d",PlayerName(playerid),asadmin ,playerid); 
            
AdminDuty3D[playerid] = CreateDynamic3DTextLabel(stringCOLOR_PIROS0.00.00.540.0playeridINVALID_VEHICLE_ID0); 
            
//Attach3DTextLabelToPlayer(AdminDuty3D[playerid], playerid, 0.0, 0.0, 0.5); 
        

        else 
        { 
             
format(sztrg,sizeof(sztrg), "{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin); 
            
SendClientMessageToAll(COLOR_LIGHTBLUE,sztrg); 
             
format(sztrg,sizeof(sztrg),"‹‹ %s Kilйpett a %s szolgбlatbуl! Ha kйrdйsed van, /report! ›› ",AdminName(playerid),asadmin); 
            
SendClientMessageToAll(COLOR_LIGHTBLUE,sztrg); 
             
format(sztrg,sizeof(sztrg), "{00FFEE}================== {C8FF00}[ %s Szolgбlat ]{00FFEE}================== ",asadmin); 
            
SendClientMessageToAll(COLOR_LIGHTBLUE,sztrg); 
            
//RemovePlayerAttachedObject(playerid,0); 
             //SetPlayerColor(playerid, COLOR_WHITE); 
             
SetPlayerToTeamColor(playerid); 
            
AdminDuty[playerid] = 0
            
gBooc[playerid] = 0
            
DestroyDynamic3DTextLabel(AdminDuty3D[playerid]); 
        } 
        return 
1
    } 
//------------- 
    //AdminSegйd Duty 
    
if(strcmp(cmd"/asduty"true) == 0
    { 
        if(!
IsOrokAS(playerid)) return 1
        if(
AsDuty[playerid] == 0
        { 
            foreach(
Jatekosok,p
            { 
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== "); 
                
SendFormatMessage(p,COLOR_YELLOW"‹‹ %s  Adminsegйdszolgбlatba lйpett, Ha segнtsйg kell /pm %d ›› ",AdminName(playerid), playerid); 
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== "); 
            } 
             
SetPlayerColor(playeridCOLOR_YELLOW); 
            
AsDuty[playerid] = 1
            
gBooc[playerid] = 1
            new 
Float:xFloat:yFloat:z
            
GetPlayerPos(playeridxyz); 
            
Format(string,"%s ADMINSEGЙD SZOLGБLATBAN\nPM: /pm %d",PlayerName(playerid),playerid); 
            
AsDuty3D[playerid] = CreateDynamic3DTextLabel(stringCOLOR_YELLOW0.00.0, -0.660.0playeridINVALID_VEHICLE_ID0); 
        } 
        else 
        { 
            foreach(
Jatekosok,p
            { 
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== "); 
                
SendFormatMessage(p,COLOR_YELLOW"‹‹ %s Kilйpett a szolgбlatbуl! Ha segнtsйg kell, /report! ›› ",AdminName(playerid)); 
                
SendClientMessage(p,COLOR_YELLOW"{00FFEE}================== {C8FF00}[ Adminsegйd szolgбlat ]{00FFEE}================== "); 
            } 
             
SetPlayerToTeamColor(playerid); 
            if(
IsTulaj(playerid)) { }  else { 
            
Nevek[playerid] = 0
            
ShowNames(playerid0); 
            } 
            
AsDuty[playerid] = 0
            
gBooc[playerid] = 0
            if(
IsValidDynamic3DTextLabel(AsDuty3D[playerid])) 
                
DestroyDynamic3DTextLabel(AsDuty3D[playerid]); 
        } 
        return 
1
    } 
Reply
#4

Ok, THX It's working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)