If Vip = 1 - 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: If Vip = 1 (
/showthread.php?tid=473996)
If Vip = 1 -
Kerth - 05.11.2013
Hi,
I have this code:
Код:
stock SprawdzVIP(playerid)
{
new bufferSprawdzVIP[127], nick[24], bool: istnieje = false;
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
mysql_real_escape_string(nick, nick);
format(bufferSprawdzVIP, 127, "SELECT 1 FROM `Gracze` WHERE `Vip`='1'", nick);
if (mysql_query(bufferSprawdzVIP)) mysql_ping();
mysql_store_result();
if (mysql_num_rows()) istnieje=true;
mysql_free_result();
return istnieje;
}
And this code:
Код:
CMD:viptest(playerid, params[])
{
if (SprawdzVIP(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, "Is{990099}VIP");
} else {
SendClientMessage(playerid, 0xFF0000FF, "Isn`t {990099}VIP");
}
return true;
}
If I type / viptest appears "Is VIP", though there is a base save '1'. How to formulate enquiry MySQL?
I want use command if `Vip`='1'
Who help me?
Re: If Vip = 1 -
Riddick94 - 05.11.2013
pawn Код:
if (mysql_num_rows()) istnieje=true;
mysql_free_result();
return istnieje;
Ustawiasz, że istnieje ale zawsze i tak zwracasz, że istnieje. Powinieneś zwrуcić wartość 'false'. Poza tym napisz mi po polsku czego bardziej potrzebujesz, potrzebujesz tego, by sprawdzać VIP? Nie lepiej jest załadować wartość raz i sprawdzać ją pуźniej poprzez zmienną array (boolean).
[ENG]
Sorry guys for using my native language, just trying to make this quick to fix cause I see no one answer, I jest let myself to wrote in different language (Polish).
Re: If Vip = 1 -
Kerth - 05.11.2013
Potrzebuję pobrać z bazy ten wynik dla, ktуrego `Vip` = '1'. Jeśli jest to można wykonać komendę, a jeśli nie jest ( `Vip` = '0') nie może.
Re: If Vip = 1 -
Jefff - 05.11.2013
pawn Код:
bool:SprawdzVIP(playerid)
{
new buffer[80], nick[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
mysql_real_escape_string(nick, nick);
format(buffer, sizeof(buffer), "SELECT Vip FROM `Gracze` WHERE `Nick` = '%s' LIMIT 1", nick);
mysql_query(buffer);
mysql_store_result();
new bool:VIP = !!mysql_fetch_int();
mysql_free_result();
return VIP;
}
Re: If Vip = 1 -
-Prodigy- - 05.11.2013
Why do you escape the player's name?
Re: If Vip = 1 -
Kerth - 06.11.2013
Ok. All is OK. Thanks.