ME

Setaccountstoragevalue E Getaccountstoragevalue

Por meubk, 06 de abr. de 2011 em Mods, funções e outros

script
4
1.6k
meubkM
06 de abril de 2011 às 14:17

Blokiando scripts por account agora ficow mais facil.

 

setAccountStorageValue(accountid, storage, value)

 

function setAccountStorageValue(accountid, storage, value)
if type(accountid) ~= "number" then
	error("[ERROR] ACCOUNT NOT IS NUMBER")
end
mountacc = accountid .. storage
setGlobalStorageValue(mountacc, value)
end

 

getAccountStorageValue(accountid, storage)

 

function getAccountStorageValue(accountid, storage)
if type(accountid) ~= "number" then
	error("[ERROR] ACCOUNT NOT IS NUMBER")
end
mountacc = accountid .. storage
return getGlobalStorageValue(mountacc)
end

 

Exemplo de uso

 

function onSay(cid)

if getAccountStorageValue(getPlayerAccountId(cid), 5656) == 1 then
	doPlayerSendCancel(cid, "Account blokiada")
else
	setAccountStorageValue(getPlayerAccountId(cid), 5656, 1)
end
return true

end

 

Fui...

tinfer3T
06 de abril de 2011 às 19:45

Muito útil sua função meu caro,será muito bem aproveitada e usada!

Parabéns

06 de abril de 2011 às 20:51

Poderia ter usado string.byte associando a tabela ASCII, assim funcionaria com letras também.

OneshotO
07 de abril de 2011 às 07:40

setGlobalStorageValue(storage, value) não irá mudar o valor de uma variável para todo o servidor?