Raised This Month: $ Target: $400
 0% 

How can I change player scoreboard.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dzinks2009
Junior Member
Join Date: Dec 2015
Old 07-09-2017 , 11:13   How can I change player scoreboard.
Reply With Quote #1

Hello, I'm trying to create a plugin where a player on reconnect would get his frags,deaths,assists,mvps, and score back from MySQL but setting the ent prop wont work.

PHP Code:
    SQL_FetchRow(hndl);
    
    
frags SQL_FetchInt(hndl,1);
    
deaths SQL_FetchInt(hndl,2);
    
mvp SQL_FetchInt(hndl,3);
    
score SQL_FetchInt(hndl,4);
    
assists SQL_FetchInt(hndl,5);

    
PrintToChatAll("=========");
    
PrintToChatAll("Frags: %d Deaths: %d MVP: %d Score: %d Assists %d"fragsdeathsmvpscoreassists);
    if (
frags != 0){
        
PrintToChatAll("frags");
        
SetEntProp(clientProp_Data"m_iFrags"frags);
    }
    if(
deaths != 0){
        
PrintToChatAll("deaths");
        
SetEntProp(clientProp_Data"m_iDeaths"deaths);    
    }
    if(
mvp != 0){
        
PrintToChatAll("mvp");
        
CS_SetMVPCount(clientmvp);
    }
    if(
score != 0){
        
PrintToChatAll("score");
        
CS_SetClientContributionScore(clientscore);
    }
    if(
assists != 0){
        
PrintToChatAll("assists");
        
CS_SetClientAssists(clientassists);
    } 
It prints out to me "Frags: 232 Deaths: 232 MVP: 232 Score: 232 Assists 232" and it prints out all of the PrintToChatAll(" assists/score/mvp/kills/deaths ") so its not 0. But when I try to set it, it wont set it.
dzinks2009 is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 07-09-2017 , 11:59   Re: How can I change player scoreboard.
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=1871412

Could possibly be your SQL but I'm not great at SQL in SP
__________________
B3none is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 07-09-2017 , 13:01   Re: How can I change player scoreboard.
Reply With Quote #3

Issue solved. This was old syntax but he wasn't declaring the variables correctly

PHP Code:
int frags SQL_FetchInt(hndl1); 
int deaths SQL_FetchInt(hndl2); 
int mvp SQL_FetchInt(hndl3); 
int score SQL_FetchInt(hndl4); 
int assists SQL_FetchInt(hndl5); 
__________________

Last edited by B3none; 07-09-2017 at 13:01.
B3none is offline
dzinks2009
Junior Member
Join Date: Dec 2015
Old 07-09-2017 , 20:40   Re: How can I change player scoreboard.
Reply With Quote #4

Quote:
Originally Posted by b3none View Post
Issue solved. This was old syntax but he wasn't declaring the variables correctly

PHP Code:
int frags SQL_FetchInt(hndl1); 
int deaths SQL_FetchInt(hndl2); 
int mvp SQL_FetchInt(hndl3); 
int score SQL_FetchInt(hndl4); 
int assists SQL_FetchInt(hndl5); 
Yep, thanks for help m8.
dzinks2009 is offline
sdz
Senior Member
Join Date: Feb 2012
Old 07-09-2017 , 21:59   Re: How can I change player scoreboard.
Reply With Quote #5

if you're using SELECT * then you'll want to use SQL_FieldNameToNum for future reference
sdz is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 22:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode