All commands in server stopped working
#1

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.
Reply
#2

Remove #include <zcmd> from your script.
Reply
#3

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

Anyone an idea why this doesn't work?
Reply
#5

show OnPlayerCommandText
Reply
#6

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

should the 7 not be an 8?
Reply
#8

I'm such an idiot. Thank you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)