Scripting help.
#4

pawn Код:
new myTime[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    myTime[playerid] = SetTimer("RegMoney", 60000, false); //This creates a timer that is 60,000 milliseconds (60 seconds) in length, and it doesn't repeat. After 60 seconds it calls our RegMoney function
}

forward RegMoney();
public RegMoney()
{
    new file[64]; //we create our string so we can format it with the players account file
    format(file, sizeof(file), "MyFiles/Accounts/%s.ini", Name(playerid)); //we format our file string to their account path
    if(!dini_Exists(file)) return SendClientMessage(playerid, 0xCC0000AA, "If you register, you recieve some cash!"); //Lets send them this if they aren't registered
    if(dini_Exists(file)) //we check if it exists
    {
        if(dini_Int(file, "RegMoney") == 0) //We check if they haven't already gotten their money (0 = they haven't, 1 = they have)
        {
            dini_SetInt(file, "RegMoney", 1); //If they don't have it set to 1, we set it to 1
            GivePlayerMoney(playerid, PocketMoney); //then we give them some money
            format(file, sizeof(file), "You've recieved $%d for registering!", PocketMoney); //we format our file string to something else
            SendClientMessage(playerid, 0x00CCCCAA, file); //we send the formatted message to the player
        }
        //We wont tell them anything if they've already got it, no need to spam them every time they spawn saying they already recieved it
    }
    KillTimer(myTime[playerid]); //We kill our timer
}
Can someone help me convert this to y_ini?
Reply


Messages In This Thread
Scripting help. - by Nicholas. - 15.01.2012, 22:08
Re: Scripting help. - by Snowman12 - 15.01.2012, 22:33
Respuesta: Re: Scripting help. - by kirk - 15.01.2012, 23:04
Re: Scripting help. - by Nicholas. - 15.01.2012, 23:27

Forum Jump:


Users browsing this thread: 1 Guest(s)