[HELP] Script. - Nicholas. - 12.02.2012
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.
Re: [HELP] Script. -
Steven82 - 12.02.2012
Quote:
Originally Posted by Nicholas.
The Login and Registration system is completed (YSI)
|
What do you mean by this? y_ini?
Re: [HELP] Script. -
2KY - 12.02.2012
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!");
}
Re: [HELP] Script. -
Madd Kat - 12.02.2012
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
Re: [HELP] Script. - Nicholas. - 12.02.2012
Thank you, 2KY.
Re: [HELP] Script. - Nicholas. - 12.02.2012
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);
Re: [HELP] Script. -
[ABK]Antonio - 12.02.2012
You're using it on public OnPlayerSpawn(playerid) correct?
Re: [HELP] Script. -
Steven82 - 12.02.2012
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.
Re: [HELP] Script. - Nicholas. - 12.02.2012
Quote:
Originally Posted by [ABK]Antonio
You're using it on public OnPlayerSpawn(playerid) correct?
|
Ah thank you. I found my problem.
Rep'ed.
Re: [HELP] Script. -
[ABK]Antonio - 12.02.2012
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!");
}