Faction from 0 - MySQL - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Faction from 0 - MySQL (
/showthread.php?tid=646696)
Faction from 0 - MySQL -
tbedy - 21.12.2017
Well, im trying to make factions from 0, on MYSQL GM
I was reading some tutorials...
I need to put this somewhere: (maybe in some command like /makeleader?)
Код:
GetPlayerName(playerid, playername, sizeof(playername)); //You still have to create the variable playername
format(string, sizeof(string), "UPDATE `table` SET factionid = %i, rank = %i WHERE Username = %s", pData[playerid][Faction], pData[playerid][Rank], playername); //Updating mysql database with facitonid/rank
mysql_query(string); //Sending the query. Remember, must still create the variable "string"
This should (part of) saving system!?
I need help about Loading system, and create table (need help here too)
I know I maybe asked a lot questions, but if someone can give me right way (at least)
Thanks for any kind of help
EDIT: Made Table:
http://prntscr.com/hqon8l
Can I makae faction here? What about functions?
Re: Faction from 0 - MySQL -
tbedy - 21.12.2017
okey, i done something following this tutorial:
https://sampforum.blast.hk/showthread.php?tid=392856
Код:
C:\Users\Toni\Desktop\aaaaaaaaaaa\gamemodes\kucni.pwn(6227) : error 035: argument type mismatch (argument 1)
C:\Users\Toni\Desktop\aaaaaaaaaaa\gamemodes\kucni.pwn(6228) : error 017: undefined symbol "mysql_store_result"
C:\Users\Toni\Desktop\aaaaaaaaaaa\gamemodes\kucni.pwn(6229) : error 017: undefined symbol "mysql_num_rows"
C:\Users\Toni\Desktop\aaaaaaaaaaa\gamemodes\kucni.pwn(6230) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Toni\Desktop\aaaaaaaaaaa\gamemodes\kucni.pwn(11170) : warning 213: tag mismatch
C:\Users\Toni\Desktop\aaaaaaaaaaa\gamemodes\kucni.pwn(11181) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
//=============== orge pokusaj
stock LoadFactions()
{
new query[400];
for(new id; id < MAX_FACTIONS; id++) // Goes through all the slots, looking for the data
{
format(query, sizeof(query), "SELECT * FROM Factions WHERE ID = %d", id); // Selects all the information from the table
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
if(mysql_fetch_row_format(query,"|"))
{
sscanf(query, "p<|>e<is[64]ds[32]s[32]s[32]s[32]s[32]>",Factions[id]); // SSCANF seperates the data into the variables
Total_Factions_Created++; // Counts the factions created
}
}
printf("> %d factions have been loaded from the database.", Total_Factions_Created); // Prints out the information of how many factions created
return 1;
}
Re: Faction from 0 - MySQL -
Isolated - 22.12.2017
Okay so could you explain what 0 factions are? Do you mean the ID?
https://sampforum.blast.hk/showthread.php?tid=56564
Use this ^ for your plugin instead.
Explain a bit better and I'll do my best to help you where possible, also query[400] should be more like 36 with a little overhead..