21.04.2012, 13:05
Hello, I have /ajail command and I want that when you jail player the jailtime would be saving to mysql
That's the code
And that's the saving
[code=pawn]format(Query, sizeof(Query), "UPDATE Users SET Jailtime='%d' WHERE Username='%s'", WHAT TO WRITE HERE?,pName);[/code]
That's the code
Код:
forward Unjail(playerid); public Unjail(playerid) { SpawnPlayer(playerid); SetPlayerInterior(playerid, 0); PInfo[playerid][Jailed] = 0; KillTimer(JailTimer[playerid]); GameTextForPlayer(playerid, "~g~Unjailed", 5000, 6); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } CMD:ajail(playerid, params[]) { new pID; new Tplayer[MAX_PLAYER_NAME]; new name[24]; new time; new reason[128]; GetPlayerName(pID,Tplayer,sizeof(Tplayer)); GetPlayerName(playerid,name,24); if(sscanf(params, "uis[128]", pID, time,reason)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /jail [playerid/name] [minutes] [reason]"); if(time <= 0) return SendClientMessage(playerid, COLOR_GREY, "Minutes can't be less than 0!"); if(pID == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't jail yourself!"); if(PInfo[playerid][Admin] == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough privilegies to use this command!"); else { new str[128]; format(str, sizeof(str), "%s has been jailed by %s for %d minutes | Reason:!", name, Tplayer, time, reason); SendClientMessageToAll(COLOR_LIGHTRED,str); JailTimer[pID] = SetTimer("Unjail", time*60*1000, false); SetPlayerPos(pID, 264.4176, 77.8930, 1001.0391); SetPlayerInterior(pID, 6); PInfo[pID][Jailed] = 1; GameTextForPlayer(pID, "~p~JAILED", 10000, 6); PlayerPlaySound(pID,1057,0.0,0.0,0.0); } return 1; }
[code=pawn]format(Query, sizeof(Query), "UPDATE Users SET Jailtime='%d' WHERE Username='%s'", WHAT TO WRITE HERE?,pName);[/code]