- 0
Ajutor salvare in baza de date
-
Similar Content
-
- 4 replies
- 274 views
-
- 3 answers
- 349 views
-
- 1 reply
- 119 views
-
- 1 reply
- 154 views
-
- 1 answer
- 100 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
Micu_Gamer
Salut, as vrea sa va intreb daca am facut ceva gresit la aceste comenzi de nu imi salveaza in baza de date ?
QUITJOB:
CMD:quitjob(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "You have quit your job!");
PlayerInfo[playerid][pJob] = 0;
DisablePlayerCheckpoint(playerid);
new szQuery[128];
mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='0' WHERE `Username`='%s'", PlayerInfo[pJob], PlayerInfo[playerid][pUsername]);
mysql_tquery(mysql, "szQuery");
}
else return SendClientMessage(playerid, COLOR_WHITE, "You don't have a job.");
}
return 1;
}
GETJOB:
CMD:getjob(playerid, params[])
{
new szQuery[256];
if(IsPlayerConnected(playerid))
{
new sendername[25],str[256];
GetPlayerName(playerid,sendername,sizeof(sendername));
if(PlayerInfo[playerid][pJob] == 0)
{
if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,607.8375,-1438.1827,14.0654))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Detective.");
PlayerInfo[playerid][pJob] = 1;
mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
mysql_tquery(mysql, szQuery);
}
else if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,359.3762,-2071.5310,10.6953))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Jobul tau este acum Fisherman.");
PlayerInfo[playerid][pJob] = 2;
mysql_format(mysql, szQuery, sizeof(szQuery), "UPDATE `users` SET `Job`='%d' WHERE `Username`='%s'", PlayerInfo[playerid][pJob], PlayerInfo[playerid][pID]);
mysql_tquery(mysql, szQuery);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Ai deja un job, foloseste comanda /quitjob pentru a parasi job ul.");
}
}
return 1;
}
SETJOB:
CMD:setjob(playerid, params[])
{
new szQuery[256];
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 6)
{
new id,jobid,string[256],giveplayer[30],sendername[30];
if(sscanf(params, "ui",id,jobid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{0049FF}Syntax: {ffffff}/setjob <Name/Playerid> <Job ID>");
{
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[id][pJob] = jobid;
format(string, sizeof(string), "Admin %s has changed you job to %d.", sendername,jobid);
SCM(id,COLOR_LIGHTBLUE, string);
new str[128];
mysql_format(mysql, szQuery, sizeof(szQuery),"UPDATE `users` SET `Job`='%d' WHERE `name`='%s'",PlayerInfo[id][pJob],PlayerInfo[id][pUsername]);
mysql_tquery(mysql, szQuery);
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, AdminOnly);
}
}
return 1;
}
Mersi!
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.