SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 07/12/2019, 07:58 PM   #1
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Exclamation OnPlayerConnect problem

Why my textdraw doesn't show up on OPC

PHP Code:
public OnPlayerConnect(playerid)
{
    if(
pInfo[playerid][IsBanned] == 1)
    {
        
TextDrawShowForPlayer(playeridTextdraw120);
        
TextDrawShowForPlayer(playeridTextdraw121);
        
TextDrawShowForPlayer(playeridTextdraw122);
        
TextDrawShowForPlayer(playeridTextdraw123);
        
TextDrawShowForPlayer(playeridTextdraw124);
        
TextDrawShowForPlayer(playeridTextdraw125);
    }
    return 
1;

__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 07/12/2019, 08:16 PM   #2
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,091
Reputation: 156
Default Re: OnPlayerConnect problem

Because the account is not loaded yet, so the ban variable is still 0
__________________
Kaliber is offline   Reply With Quote
Old 07/12/2019, 08:19 PM   #3
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: OnPlayerConnect problem

And there is no way to do this on player connect?
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 07/12/2019, 08:21 PM   #4
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,091
Reputation: 156
Default Re: OnPlayerConnect problem

Well, sure, you could load only the ban variable from the database (or File System?) and check the value like you did
__________________
Kaliber is offline   Reply With Quote
Old 07/12/2019, 08:26 PM   #5
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: OnPlayerConnect problem

and what would happen if i remove this from OPC?

PHP Code:
pInfo[playerid][IsBanned] = 0
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 07/12/2019, 08:29 PM   #6
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,091
Reputation: 156
Default Re: OnPlayerConnect problem

This would not work.

Because if you ban someone...and he leaves the server and another player comes online, he got the playerid of the player before him. But he is not realated to this person...


So just read the saved variable.
__________________
Kaliber is offline   Reply With Quote
Old 07/12/2019, 08:31 PM   #7
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: OnPlayerConnect problem

Quote:
Originally Posted by Kaliber View Post
Well, sure, you could load only the ban variable from the database (or File System?) and check the value like you did
What do you mean by 'only'?

i have these ones too:

PHP Code:
    pInfo[playerid][Kills] = 0;
    
pInfo[playerid][Deaths] = 0;
    
pInfo[playerid][AdminLevel] = 0;
    
pInfo[playerid][LoggedIn] = 0
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R

Last edited by Mattski; 07/12/2019 at 09:37 PM.
Mattski is offline   Reply With Quote
Old 07/12/2019, 09:40 PM   #8
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: OnPlayerConnect problem

Please help
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski is offline   Reply With Quote
Old 07/12/2019, 09:46 PM   #9
DomagojSellug
Huge Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 255
Reputation: 22
Default Re: OnPlayerConnect problem

Quote:
Originally Posted by Mattski View Post
What do you mean by 'only'?
In the login dialog you probably have a few lines which are loading the player stats, right?

He means that you copy the line from that part where it loads the "banned" variable from the player's file, and assigns it in-game, so the pBanned would actually work instead of being 0 by default when the file wasn't loaded yet.
__________________

San Andreas Multiplayer server based off Counter Strike: Global Offensive.

Join us today!

DISCORD: discord.sa-go.info
WEBSITE: http://sa-go.info
SERVER IP: samp.sa-go.info
DomagojSellug is offline   Reply With Quote
Old 07/12/2019, 09:51 PM   #10
Mattski
Big Clucker
 
Mattski's Avatar
 
Join Date: Oct 2019
Location: Under Your Moms Bed
Posts: 143
Reputation: 1
Default Re: OnPlayerConnect problem

My OPC:

PHP Code:
public OnPlayerConnect(playerid)
{
    
PlayAudioStreamForPlayer(playerid"https://*******/2OInqJF");
    
SpamCount[playerid]=0;//Reset the SpamCount variable so no player can get muted wrongly after connect!
    
muted[playerid]=0;//same for mute variable!

    
pInfo[playerid][Kills] = 0;
    
pInfo[playerid][IsBanned] = 0;
    
pInfo[playerid][Deaths] = 0;
    
pInfo[playerid][AdminLevel] = 0;
    
pInfo[playerid][LoggedIn] = 0;
    
    new 
File[128],string[128];
    
format(File,sizeof(File),PLAYER_FILE,PlayerName(playerid));
    
    if(
fexist(File)) {
        if(!
strcmp(PlayerIp(playerid),dini_Get(File,"IP"),true)) {
            
GivePlayerMoney(playerid, -GetPlayerMoney(playerid) + dini_Int(File,"Money"));
            
SetPlayerScore(playeriddini_Int(File,"Score"));
            
pInfo[playerid][Kills] = dini_Int(File,"Kills");
            
pInfo[playerid][IsBanned] = dini_Int(File,"IsBanned");
            
pInfo[playerid][Deaths] = dini_Int(File,"Deaths");
            
pInfo[playerid][AdminLevel] = dini_Int(File,"AdminLevel");
            
pInfo[playerid][LoggedIn] = 1;
            
format(string,128,"{FFFFFF}[SERVER] {00CC33}You have been loggedin automaticaly {FFFFFF}[IP-MATCH] [Money: $%d | EXP: %d]",GetPlayerMoney(playerid),GetPlayerScore(playerid));
            
SendClientMessage(playeridCOLOR_GREEN,string);
        }else {
            
ShowPlayerDialog(playeridDIALOGID+2DIALOG_STYLE_INPUT"{FFFF00}Login","{00CC33}Enter your password to login:","{00CC33}Login","{CC0000}Quit");
        }
    }else {
        
ShowPlayerDialog(playeridDIALOGID+1DIALOG_STYLE_INPUT"{FFFF00}Register","{00CC33}Enter password to register:","{00CC33}Register","");
    }
    return 
1;

So, i should move this:
PHP Code:
pInfo[playerid][IsBanned] = dini_Int(File,"IsBanned"); 
OnPlayerSpawn..?
__________________

MY WORK:
Player Name Tags - https://pastebin.com/xncXzr0R
Mattski 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
Problem with OnPlayerConnect sjames Scripting Help 1 09/08/2015 09:24 PM
OnPlayerConnect problem rutger188 Scripting Help 1 06/04/2014 03:18 PM
OnPlayerConnect Problem ??? AwokenNeoX Scripting Help 2 03/11/2012 08:53 PM
OnPlayerConnect Problem... Unknown123 Help Archive 10 06/03/2011 01:05 AM
OnPlayerConnect Problem ( 0.3a ) Micko9 Help Archive 4 29/01/2010 09:08 AM


All times are GMT. The time now is 05:10 AM.


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