SA-MP Forums Archive
/suspend is crashing the server. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /suspend is crashing the server. (/showthread.php?tid=68340)



/suspend is crashing the server. - introzen - 09.03.2009

This /suspend is causing samp-server.exe to crash... Anyone know why? =) Thanks...

pawn Код:
dcmd_suspend(playerid, params[])
    {
    new pName[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string,sizeof(string),"EQRP/Players/%s.ini",pName);
    new id, reason[64], reason2[64], Banned[MAX_PLAYER_NAME],Banner[MAX_PLAYER_NAME];
    if(dini_Int(string,"AdminLVL") == 0) return 1;
    if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, COLOR_DARKRED, "Usage: \"/suspend <playerid/partname> <reason (optional)>\"");
    else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_DARKRED, "Player not found");
    else
    {
      GetPlayerName(playerid,Banner,sizeof(Banner));
      GetPlayerName(id,Banned,sizeof(Banned));
        format(reason, sizeof (reason), "You have been banned%s%s.", reason[0] ? (" for: ") : (""), reason);
        format(reason2, sizeof (reason2), "Admin %s banned %s %s%s.",Banner,Banned, reason[0] ? (" for: ") : (""));
        SendClientMessageToAll(COLOR_DARKRED,reason2);
        SendClientMessage(id, COLOR_DARKRED, reason);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Player banned");
        BanEx(id,reason);
    }
    return 1;
    }



Re: /suspend is crashing the server. - Mauzen - 09.03.2009

Propably its the sscanf

Код:
sscanf(params, "uz", id, reason)
I think u and z are both no valid formats, try "is" for integer and string, this should work


Re: /suspend is crashing the server. - Finn - 09.03.2009

Edit: delete.


Re: /suspend is crashing the server. - introzen - 09.03.2009

It wasn't the problem :P But i fixed it myself thx anyway...