How can i make an police wanted file?
#1

I want an police wanted file, like wenn ich do "/akte (German) PlayerName", then an Dialog should appear where all crimes that he did in the past are listed.

But i don't want 4 fields in my MYSQL Table with "file1, file2,file3,file4" and so one or crime1 2 3 4, but something, that creates an entry in the table, that you can see in the dialog. But i must save it somewhere in my enum, but i don't know how
Reply
#2

Create a new table called crimes or something.
Add 2 fields. ID or playername and a field maybe called crime.
Now save the crime in the crime field and the name/userid into the other field.

You can then select them like this:
PHP код:
SELECT FROM `crimesWHERE `PlayerName` = '' 
Reply
#3

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Create a new table called crimes or something.
Add 2 fields. ID or playername and a field maybe called crime.
Now save the crime in the crime field and the name/userid into the other field.

You can then select them like this:
PHP код:
SELECT FROM `crimesWHERE `PlayerName` = '' 
I know that, but i don't know how to save them, they should not be deleted at restart or something, they should be saved forever, or until someoone deletes it with an mdc from the police that i made, but how can i show it in a dialog? I must save it in an array or something, but without limits
Reply
#4

PHP код:
new playerName[MAX_PLAYER_NAME];
new 
query[128];
GetPlayerName(playeridplayerNamesizeof playerName);
mysql_format(dbquerysizeof query"INSERT INTO `crimes` (`playername`, `commitedcrime`) VALUES ('%e', '%e')"playerNamecommitedCrime); // commitedCrime would be the variable where you'd store the crime that the player has commited
mysql_tquerry(dbquery); 
And when you wanna show the dialog.

PHP код:
new playerName[MAX_PLAYER_NAME];
new 
query[128];
GetPlayerName(playeridplayerNamesizeof playerName);
mysql_format(dbquerysizeof query"SELECT * FROM `crimes` WHERE `playername` = '%e'"playerName);
mysql_tquery(dbquery"CrimeCallback");
forward CrimeCallback();
public 
CrimeCallback(){
    new 
rows_found cache_num_rows();
    if(
rows_found 0){
        new 
crimesArray[rows_found]; // edited
        
for(var i=0i<rows_found;i++){
             
cache_get_value_name(i"commitedcrime"crimesArray[i], max_size_of_crime);
        }
        
format(bla bla blacrimesArray[0],crimesArray[1]...);
        
ShowPlayerDialog(bla bla blathe_formatted_string);
        
        
    } else {
        
ShowPlayerDialog(bla bla bla"No crimes commited");
    }

And if this doesn't work straight away you may have to save the cache and activate it first.
Reply
#5

Quote:
Originally Posted by Phreak
Посмотреть сообщение
PHP код:
new playerName[MAX_PLAYER_NAME];
new 
query[128];
GetPlayerName(playeridplayerNamesizeof playerName);
mysql_format(dbquerysizeof query"INSERT INTO `crimes` (`playername`, `commitedcrime`) VALUES ('%e', '%e')"playerNamecommitedCrime); // commitedCrime would be the variable where you'd store the crime that the player has commited
mysql_tquerry(dbquery); 
And when you wanna show the dialog.

PHP код:
new playerName[MAX_PLAYER_NAME];
new 
query[128];
GetPlayerName(playeridplayerNamesizeof playerName);
mysql_format(dbquerysizeof query"SELECT * FROM `crimes` WHERE `playername` = '%e'"playerName);
mysql_tquery(dbquery"CrimeCallback");
forward CrimeCallback();
public 
CrimeCallback(){
    new 
rows_found cache_num_rows();
    if(
rows_found 0){
        new 
crimesArray[rows_found]; // max number of crimes to be shown in the brackets
        
for(var i=0i<rows_found;i++){
             
cache_get_value_name(i"commitedcrime"crimesArray[i], max_size_of_crime);
        }
        
format(bla bla blacrimesArray[0],crimesArray[1]...);
        
ShowPlayerDialog(bla bla blathe_formatted_string);
        
        
    } else {
        
ShowPlayerDialog(bla bla bla"No crimes commited");
    }

And if this doesn't work straight away you may have to save the cache and activate it first.
That doesnt work, because cache_get_value_name is not defined and rows_found is an error
Reply
#6

What mysql plugin do you use and what version of it?
This should work with BlueG r41.

(What's the error by the way?)
Reply
#7

Quote:
Originally Posted by ImTobi
Посмотреть сообщение
when i take this version, everything is undefined and i don't want to change so many lines
Ever heard of CTRL + h? Its not gonna fix itself you know
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)