25.05.2014, 08:54
So i've started learning mysql, and now i have a problem that i can't solve.
So when i press ENTER key it should redirect me to a mysql thread that will spawn me and etc. but it wont work when i press ENTER it does give me money, score, but it wont redirect to the thread:
So when i press ENTER key it should redirect me to a mysql thread that will spawn me and etc. but it wont work when i press ENTER it does give me money, score, but it wont redirect to the thread:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(rPodesavanjeLika[playerid] == 1)
{
PI[playerid][Spol] = rSpol[playerid];
PI[playerid][Godine] = rGodine[playerid];
strmid(PI[playerid][Drzava], Porekla[rDrzava[playerid]][0], 0, strlen(Porekla[rDrzava[playerid]][0]), 255);
PI[playerid][Novac] = 300;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, 300);
SetPlayerScore(playerid, 1);
mysql_query("SELECT MAX(ID) FROM `Igraci`", THREAD_UPISIPODATKE, playerid);
}
}
return 1;
}
pawn Код:
case THREAD_UPISIPODATKE:
{
mysql_store_result();
new newid = mysql_fetch_int() + 1;
mysql_free_result();
new email[50];
mysql_real_escape_string(PI[extraid][Email], email);
new iString[2100];
format(iString, sizeof(iString), "INSERT INTO `Igraci` (`ID`, `Ime`, `Lozinka`, `Email`, `Novac`, `Spol`, `Godine`, `Drzava`, `Skin`) VALUES ('%d', '%s', '%s', '%s', \
'%d', '%d', '%d', '%s', '%d'", newid, ImeIgraca(extraid), PI[extraid][Lozinka], email, PI[extraid][Novac], PI[extraid][Spol],
PI[extraid][Godine], PI[extraid][Drzava], PI[extraid][Skin]);
mysql_query(iString, THREAD_REGISTRUJ, extraid);
}
case THREAD_REGISTRUJ:
{
TogglePlayerControllable(extraid, 1);
TextDrawDestroy(rOpcije0[extraid]);
TextDrawDestroy(rOpcije1[extraid]);
TextDrawDestroy(rOpcije2[extraid]);
TextDrawDestroy(rOpcije3[extraid]);
TextDrawDestroy(rOpcije4[extraid]);
TextDrawDestroy(rOpcije5[extraid]);
TextDrawDestroy(rOpcije6[extraid]);
rPodesavanjeLika[extraid] = 0;
if(PI[playerid][Spol] == 0)
{
SetPlayerSkin(playerid, 37);
PI[playerid][Skin] = 37;
}
else if(PI[playerid][Spol] == 1)
{
SetPlayerSkin(playerid, 40);
PI[playerid][Skin] = 40;
}
SetCameraBehindPlayer(extraid);
SetPlayerInterior(extraid, 0);
SetPlayerVirtualWorld(extraid, 0);
SetPlayerPos(extraid, 1642.5886,-2333.0972,13.5469);
SetPlayerFacingAngle(extraid, 0.9267);
for(new i; i < 100; i++) { SCM(extraid, CRNA, ""); }
SCM(extraid, ZUTA, " - Dobrodosli na Roleplay Factory, ovo je vas prvi boravak na serveru !");
SCM(extraid, ZUTA, " - Ukoliko vam treba pomoc oko komandi pisite '/komande'");
}