SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/12/2019, 02:47 PM   #11
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: Online time money

Quote:
Originally Posted by Joe Staff View Post
No, because the timer is for everybody, not for each player.

PHP Code:
public OnPlayerDisconnect(playeridreason)
{
    
PlayingMinutes[playerid] = 0;
    return 
1;


Edit: fixed typo
i just need to replace this with killtimer, and that's it?
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 03/12/2019, 02:51 PM   #12
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Online time money

Quote:
Originally Posted by Mattski View Post
i just need to replace this with killtimer, and that's it?
Be sure that your SetTimer is under OnGameModeInit and then that's it.
Joe Staff is offline   Reply With Quote
Old 03/12/2019, 02:55 PM   #13
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: Online time money

Quote:
Originally Posted by Joe Staff View Post
Be sure that your SetTimer is under OnGameModeInit and then that's it.
my Admin system isn't in my gamemode, so should i put it under OnFilterScriptInIt?
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 03/12/2019, 03:01 PM   #14
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: Online time money

hm..

PHP Code:
pwn(243) : warning 235: public function lacks forward declaration (symbol "CountOnlineTime")
pwn(244 -- 245) : error 029invalid expressionassumed zero
pwn
(244 -- 245) : warning 215expression has no effect
pwn
(245) : error 001expected token";"but found "new"
pwn(245) : error 020invalid symbol name ""
pwn(245) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


4 Errors

PHP Code:
public CountOnlineTime() //line 243
(                                             //line 244
    
foreach(new Player) if(pInfo[playerid][AdminLevel] == 1//line 245 
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 03/12/2019, 03:11 PM   #15
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Online time money

Quote:
Originally Posted by Mattski View Post
hm..

PHP Code:
pwn(243) : warning 235: public function lacks forward declaration (symbol "CountOnlineTime")
pwn(244 -- 245) : error 029invalid expressionassumed zero
pwn
(244 -- 245) : warning 215expression has no effect
pwn
(245) : error 001expected token";"but found "new"
pwn(245) : error 020invalid symbol name ""
pwn(245) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


4 Errors

PHP Code:
public CountOnlineTime() //line 243
(                                             //line 244
    
foreach(new Player) if(pInfo[playerid][AdminLevel] == 1//line 245 

if(pInfo[playerid][AdminLevel]

Change playerid to 'm' in this case.
Since you've changed the variable to m, you'll need to make sure all of the instances of 'i' in the code provided to changed too
Joe Staff is offline   Reply With Quote
Old 03/12/2019, 03:13 PM   #16
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: Online time money

doesn't change anything, errors are the same
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 03/12/2019, 03:14 PM   #17
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 463
Reputation: 20
Default Re: Online time money

Quote:
Originally Posted by Joe Staff View Post
if(pInfo[playerid][AdminLevel]

Change playerid to 'm' in this case.
Since you've changed the variable to m, you'll need to make sure all of the instances of 'i' in the code provided to changed too
Also, make sure you've forwarded the function.
When using a public, make sure to forward it.

Add this anywhere above your public function:
PHP Code:
forward CountOnlineTime(); 
__________________
Developer @ Trucknation
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
An upcoming mix of trucking & light roleplay
Proxus is offline   Reply With Quote
Old 03/12/2019, 03:18 PM   #18
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: Online time money

already did that, nothing changes
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 03/12/2019, 03:25 PM   #19
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: Online time money

Now it looks like this:

PHP Code:
new PlayingMinutes[MAX_PLAYERS];

public 
OnFilterScriptInit()
{
    
SetTimer("CountOnlineTime"60000true); //1 minute
    
return 1;
}

forward CountOnlineTime();
public 
CountOnlineTime()
(
    foreach(new 
Player) if(pInfo[m][AdminLevel] == 1)
    {
        
PlayingMinutes[m] ++;
        if(
PlayingMinutes[m] == 30)
        {
            
SendClientMessage(mWHITE"{FFFFFF}[SERVER] {00CC33}30 Min playing time bonus $25000");
            
GivePlayerMoney(m25000);
            
PlayingMinutes[m] = 0;
        }
    }
}

public 
OnPlayerDisconnect(playeridreason)
{
    
PlayingMinutes[m] = 0;
    return 
1;

but it's giving me those errors
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 03/12/2019, 03:25 PM   #20
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 463
Reputation: 20
Default Re: Online time money

Quote:
Originally Posted by Mattski View Post
already did that, nothing changes
Odd, can you show some code above the snippet you provided?
__________________
Developer @ Trucknation
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
An upcoming mix of trucking & light roleplay
Proxus is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Earning money online on PayPal fast ? VIP475 Everything and Nothing 2 11/06/2014 10:46 AM
How can I get money online? SounDD Everything and Nothing 6 11/08/2013 01:03 AM
Some simple ways to earn money online! kanersps Everything and Nothing 3 24/02/2013 06:20 PM
[How To] Make Money Online Mikailcan Everything and Nothing 3 24/02/2013 01:38 PM
Suggest me How to make some money online Black_Death Everything and Nothing 23 18/09/2011 09:30 PM


All times are GMT. The time now is 04:51 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.