SA-MP Forums Archive
Server closes when i type a CMD - 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: Server closes when i type a CMD (/showthread.php?tid=356629)



Server closes when i type a CMD - Nunes - 04.07.2012

public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp("/createemail", cmdtext, true, 10) == 0)
{

if(GetPlayerMoney(playerid) < 1000)

return SendClientMessage(playerid, 0xAFAFAFAA,"You don't have money enought.");

new email[32];

format(email,32,Local,Player(playerid));

if(dini_Exists(email))

return SendClientMessage(playerid, 0xAFAFAFAA,"You have a computer.");

dini_Create(email);

for(new i=0;i<sizeof(Emails);i++)

dini_Set(email,Emails[i],"Empyt");

GameTextForPlayer(playerid, "Cost: $1000", 5000, 1);
GivePlayerMoney(playerid, -2000);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xAFAFAFAA, "Now you have an e-mail account.");

return 1;
}



I scripted an e-mail system but when i type the cmd /createemail the server close automatically. Could you help me to find the mistake?


Re: Server closes when i type a CMD - [NWA]Hannes - 04.07.2012

Can I see your define for "Local"?
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/createemail", cmdtext, true, 10) == 0)
    {
        if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xAFAFAFAA,"You don't have money enought.");
        else
        {
            new email[32];
            format(email, 32, Local, Player(playerid));

            if(dini_Exists(email)) return SendClientMessage(playerid, 0xAFAFAFAA,"You have a computer.");

            dini_Create(email);

            for(new i=0;i<sizeof(Emails);i++)
            {
                dini_Set(email,Emails[i],"Empyt");
                GameTextForPlayer(playerid, "Cost: $1000", 5000, 1);
                GivePlayerMoney(playerid, -2000);
                PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xAFAFAFAA, "Now you have an e-mail account.");
            }
        }
        return 1;
    }
    return 0;
}



Re: Server closes when i type a CMD - Nunes - 04.07.2012

U're right, the local... i created the folders that was cited on FS and now it works (: thnx