MySQL Table changin
#1

Hello Guts! I have 2 variables saved in Database(Table) one count Hours(Vhours = theammount of hours) and another one check if its 1 or 0(Active= 1/0). I want to check this table and if VHours is more than 20 then set it to 0 and if active = 0 set it to 1
But the problem is i dont want to check only for players who Connect to the server but for all Table! Someone help me with this
Reply
#2

Please provide an example and more details, what do you mean with
Quote:

i dont want to check only for players who Connect to the server but for all Table!

Reply
#3

PHP код:
`plr_veteranSET `Actve`=1 WHERE `VHOURS` > 20"); 
But i want to set this for all database if they are VHOURS > 20 Not just for players who connect to server. I want to do it to all Table plr_veteran
Reply
#4

For example making it under OnGameModeInIt?
Reply
#5

Quote:
Originally Posted by Xportaler
Посмотреть сообщение
PHP код:
`plr_veteranSET `Actve`=1 WHERE `VHOURS` > 20"); 
But i want to set this for all database if they are VHOURS > 20 Not just for players who connect to server. I want to do it to all Table plr_veteran
Can you show me the full line?
Reply
#6

This is what im trying to create! This is what i want to do but i dont know how to do it through pawn to edit it also for players who are not online and set it to 1 or 0 even for players who dont connect to server
Reply
#7

Quote:
Originally Posted by Xportaler
Посмотреть сообщение
This is what im trying to create! This is what i want to do but i dont know how to do it through pawn to edit it also for players who are not online and set it to 1 or 0 even for players who dont connect to server
I understood, but show me more code, because there isn't any problem in the code you gave!
Reply
#8

PHP код:
forward Checkveteran(); 
public 
Checkveteran() 

    for(new 
i;i<MAX_PLAYERS;i++) 
    { 
        if(
IsPlayerConnected(i)) 
        { 
            
pGeneral[i][PLR_VETERAN] = 0
            
pGeneral[i][OLD_HOURS] = 0
        } 
         
    } 
    
mysql_query_nodata("UPDATE `plr_veteran` SET `RANK_STATUS`=0,`RANK_UPDATED`=1"); 
     
mysql_query_nodata("UPDATE `plr_veteran` SET `RANK_STATUS`=1,`RANK_UPDATED`=1 WHERE `OLD_HOURS` > 20"); 
      
mysql_query_nodata("UPDATE plr_veteran SET `OLD_HOURS` = 0"); 
    return 
1

But now it will go more complicated!
this is variables im using now
Reply
#9

Try this:
PHP код:
mysql_query_nodata("SELECT * FROM `plr_veteran` ORDER BY `ID` ASC"); //Change the `ID` to the name of the variable which you are using line order
mysql_query_nodata("UPDATE `plr_veteran` SET `Actve`= '1' WHERE `VHOURS` > '20'"); 
I'm not sure if it will work! (I'm still learning MySQL)
EDITED: Code was edited a little!
Reply
#10

Under
PHP код:
public OnGameModeInIt 
add
PHP код:
Checkveteran(); 
to run a check for all, But the
PHP код:
        if(IsPlayerConnected(i)) 
Should be removed because it will make the check only for online players..

EDIT:But don't forget to add under the function you sent the line which you sent us to make the main thing that you want..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)