06.03.2015, 14:29
Well, with dini, this is real hard, but you can easy use SQLite for this
Here an example:
I hope this helps you
Greekz
Here an example:
PHP код:
//At top:
new DB:plate;
//OnGameModeInit
plate = db_open("Plates.db");
db_free_result(db_query(plate,"CREATE TABLE IF NOT EXISTS `Plates` (`Name`,`Plate`)"));
//OnGameModeExit
db_close(plate);
//The function i made for u :*
stock InsertPlate(playerid,const doc[]) {
new string[128],name[MAX_PLAYER_NAME],DBResult:result;
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,128,"SELECT `Name` WHERE `Plate`='%s'",doc);
result = db_query(plate,string);
if(db_num_rows(result) != 0) return 0;
format(string,128,"INSERT INTO `Plates` ('Name','Plate') VALUES ('%s','%s')",name,doc);
db_query(plate,string);
return SendClientMessage(playerid,-1,"Your plate was added.");
}
//How to use
InsertPlate(playerid,"XYZ");
//If this would exist, it would return 0, so you can do sth like this:
new doc[32] = "XYZ";
while(!InsertPlate(playerid,doc)) {
strcat(doc,"c");
//So it would add 'c' to the string, till nobody have this plate :)
}
//Or you just let the player type the plate :D
Greekz