SA-MP Forums Archive
All commands in server stopped working - 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: All commands in server stopped working (/showthread.php?tid=395338)



All commands in server stopped working - DaRoderick - 25.11.2012

Hi,

So I'm making a new gamemode from scratch. Now I followed a tutorial (https://sampforum.blast.hk/showthread.php?tid=377207) on the forums and tried to convert a command to dcmd. When I started the server up, most of the commands are not working anymore.

This is the code:

Код:
dcmd_buylevel(playerid,params[])
{
		#pragma unused params
		new string[30]; // String.
        if(IsPlayerConnected(playerid) == 1) // Checks if player is connected.
        {
            new points[248]; // Points.
            new nxtlevel = AccInfo[playerid][pLevel]+1; // As soon as its executed, It adds +1 to your score.
            new expamount = nxtlevel*levelexp; // Exp amount, Its 2 CURRENTLY but you can raise it by adding +number after levelexp
            if(AccInfo[playerid][Exp] < expamount) // Checks if player's exp amount is above the required one or not.
            {
                format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,AccInfo[playerid][Exp]); // Format, This is pretty obvious.
                SendClientMessage(playerid,LIME,points); // Sends the message.
                return 1;
            }
            else
            {
                AccInfo[playerid][Exp] = 0; //  Sets the EXP amount to 0 as you level'd up.
                AccInfo[playerid][pLevel]++; // Adds a level.
                format(string,sizeof(string),"~g~Your now level:[%d]",AccInfo[playerid][pLevel]); // Format.
                GameTextForPlayer(playerid,string,6000,1); // Sends gametext about his new level'ing up.
                return 1;
            }
        }
        return 1;
}
Could anyone please explain what exactly went wrong? I'm new to scripting and I wish to learn it, but it's hard to do it all on my own hehe.


Re: All commands in server stopped working - SuperViper - 25.11.2012

Remove #include <zcmd> from your script.


Re: All commands in server stopped working - DaRoderick - 25.11.2012

Alright, now the other commands work, but the dcmd_buylevel part is still not working..


Re: All commands in server stopped working - DaRoderick - 25.11.2012

Anyone an idea why this doesn't work?


Re: All commands in server stopped working - Joe Staff - 26.11.2012

show OnPlayerCommandText


Re: All commands in server stopped working - DaRoderick - 26.11.2012

I put this in OnPlayerCommandText
Код:
	dcmd(buylevel,7,cmdtext);



Re: All commands in server stopped working - cosbraa - 26.11.2012

should the 7 not be an 8?


Re: All commands in server stopped working - DaRoderick - 26.11.2012

I'm such an idiot. Thank you.