[HELP] Script.
#1

Hello.

Thank you for viewing this thread. I need some assistance with my scripting.

The Login and Registration system is completed (YSI). Now I want the player to receive registration cash after they have spawn but I want to add a timer so it would take 1 minute after spawn to receive the cash.

I have tried already but I keep getting errors for various reason. So this is my last choice to request some help.

In return I would be gladly to give you a forum's reputation to show my appreciation.
Reply
#2

Quote:
Originally Posted by Nicholas.
Посмотреть сообщение
The Login and Registration system is completed (YSI)
What do you mean by this? y_ini?
Reply
#3

Well, after spawning them after they've registered, use this:

pawn Код:
SetTimerEx("RegisterCash", 60000, false, "i", playerid); //Sets a timer for "Register Cash" at 1 minute and does not repeat itself and stores their playerid.

forward RegisterCash(playerid);

public RegisterCash(playerid)
{
        GivePlayerMoney(playerid, 100);
        return SendClientMessage(playerid, -1, "{FFFFFF}You have been given $100 as a gift!");
}
Reply
#4

Better yet when they reg save the default cash to the ini file
On spawn load the cash
Then you wont need a timer.

Edit: never mind i see you want a timer
Reply
#5

Thank you, 2KY.
Reply
#6

So Yeah.

I have added it. Now I keep getting this error.

pawn Код:
C:\Users\Toshiba\SA-MP\SA-MP Scripting\RPG\gamemodes\RPG.pwn(102) : error 017: undefined symbol "playerid"
Here's my line (102)

pawn Код:
SetTimerEx("RegisterCash", 1000, false, "i", playerid);
Reply
#7

You're using it on public OnPlayerSpawn(playerid) correct?
Reply
#8

Quote:
Originally Posted by Nicholas.
Посмотреть сообщение
So Yeah.

I have added it. Now I keep getting this error.

pawn Код:
C:\Users\Toshiba\SA-MP\SA-MP Scripting\RPG\gamemodes\RPG.pwn(102) : error 017: undefined symbol "playerid"
Here's my line (102)

pawn Код:
SetTimerEx("RegisterCash", 1000, false, "i", playerid);
When they finish registering, add this code underneath it all.
Reply
#9

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
You're using it on public OnPlayerSpawn(playerid) correct?
Ah thank you. I found my problem.

Rep'ed.
Reply
#10

Quote:
Originally Posted by Nicholas.
Посмотреть сообщение
Ah thank you. I found my problem.

Rep'ed.
I would recommend you modify it a little bit if you're going to use OnPlayerSpawn, something like....


pawn Код:
new bool:FirstSpawn[MAX_PLAYERS]; //This would be outside of everything

/*
    Inside of the registration code, add FirstSpawn[playerid] = true;
    Inside of OnPlayerConnect i would also add FirstSpawn[playerid] = false;
    This way when they register, it's going to be true, when they are already registered,
    it won't be true
*/


public OnPlayerSpawn(playerid)
{
    if(FirstSpawn[playerid] == true) SetTimerEx("RegisterCash", 60000, false, "i", playerid); //Sets a timer for "Register Cash" at 1 minute and does not repeat itself and stores their playerid.
    return 1;
}

forward RegisterCash(playerid);

public RegisterCash(playerid)
{
    GivePlayerMoney(playerid, 100);
    FirstSpawn[playerid] = false; //EDIT: forgot this lol
    return SendClientMessage(playerid, -1, "{FFFFFF}You have been given $100 as a gift!");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)