What's new

Talkactions Kto z supportu jest Online?

Status
Not open for further replies.

qwasniak

Advanced User
Joined
May 9, 2013
Messages
303
Reaction score
7
No to zaczynamy.
Do Data/Talkactions/Scripts robimy Support.lua, i wklejamy to :
PHP:
function onSay(cid, words, param, channel) 
    local Info = db.getResult("SELECT * FROM `players` WHERE `online` = '1' AND `group_id` > 1") 
    local PlayerString = "Osoby online z administracji:\n" 
    if Info:getID() ~= -1 then 
        local count, i = Info:getRows(false), 0 
           repeat 
           PlayerString = PlayerString .. Info:getDataString("name") .. " - "  
           if Info:getDataInt("group_id") == 2 then 
           PlayerString = PlayerString .. "Helper" 
		   elseif Info:getDataInt("group_id") == 3 then 
           PlayerString = PlayerString .. "Junior Tutor"   
           elseif Info:getDataInt("group_id") == 4 then 
           PlayerString = PlayerString .. "Tutor"     
           elseif Info:getDataInt("group_id") == 5 then 
           PlayerString = PlayerString .. "JGM"             
           elseif Info:getDataInt("group_id") == 6 then 
           PlayerString = PlayerString .. "GM"     
           elseif Info:getDataInt("group_id") == 7 then 
           PlayerString = PlayerString .. "Administrator" 
            end 
         PlayerString = PlayerString .. "\n" 
           until not(Info:next()) 
                          Info:free() 
           else 
           PlayerString = PlayerString .. "Nikt z administracji nie jest online." 
           end 
           doPlayerPopupFYI(cid, PlayerString); 
    return true 
end
Mozemy tez zmienic ten skrypt, wchodzac w data/xml/groups i wpisujac groupid.
Teraz Talkactions.xml
PHP:
<talkaction words="!support" event="script" value="support.lua"/>
No to chyba tyle ;P
 

#Adaś

Senior User
Joined
Jan 22, 2011
Messages
780
Reaction score
23
Odp: Kto z supportu jest Online?

O kurde! Super skrypt! Przydal mi sie!!!!!!!! Dzieki uzylem go wszedzie!!!!! Tylko chyba juz go mialem xD
 

MiksereQ

Banned
Joined
Jul 2, 2013
Messages
531
Reaction score
32
Odp: Kto z supportu jest Online?

Takie co? nawet w datapacku sanda jest ;.
 

Szeroki368

Active User
Joined
Jan 11, 2014
Messages
85
Reaction score
0
Age
34
Odp: Kto z supportu jest Online?

super skrypt i dzia?a Polecam
 

sawex

Advanced User
Joined
Aug 17, 2008
Messages
421
Reaction score
23
Odp: Kto z supportu jest Online?

Nie r?b Select *, je?eli potrzebujesz 2 - 3 pola z tabeli players.

Ten warunek:
[LUA]if Info:getDataInt("group_id") == 2 then
PlayerString = PlayerString .. "Helper"
elseif Info:getDataInt("group_id") == 3 then
PlayerString = PlayerString .. "Junior Tutor"
elseif Info:getDataInt("group_id") == 4 then
PlayerString = PlayerString .. "Tutor"
elseif Info:getDataInt("group_id") == 5 then
PlayerString = PlayerString .. "JGM"
elseif Info:getDataInt("group_id") == 6 then
PlayerString = PlayerString .. "GM"
elseif Info:getDataInt("group_id") == 7 then
PlayerString = PlayerString .. "Administrator"
end [/LUA]

Mo?na by zast?pi? czym? w stylu:
Przed onSay
[CPP]local group_names = {
[2] = "Helper",
[3] = "Junior Tutor",
...
}[/CPP]

A potem w skrypcie
[LUA] PlayerString = PlayerString .. group_names[Info:getDataInt("group_id")][/LUA]
 
Status
Not open for further replies.
Top