Jump to content

I can't find a mistake in this script!!!


Recommended Posts

Posted

4V4PMON.png

function HunterInfo(source, hunters, person) 
  
    if person == nil and getAccountData(getPlayerAccount(source),"hunter.counts") == false then 
        outputChatBox("#FFFFFFYou did not reach the Hunter yet.", source, 255,255,255,true) 
    elseif person == nil and getAccountData(getPlayerAccount(source),"hunter.counts") == 1 then 
        outputChatBox("#FFFFFFYou have reached the Hunter#FF0000 "..getAccountData(getPlayerAccount(source),"hunter.counts").." #FFFFFFtime.",source,255,255,255,true) 
    elseif person == nil and getAccountData(getPlayerAccount(source),"hunter.counts") > 1 then 
        outputChatBox("#FFFFFFYou have reached the Hunter#FF0000 "..getAccountData(getPlayerAccount(source),"hunter.counts").." #FFFFFFtimes.",source,255,255,255,true) 
    elseif getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts") == false then 
        outputChatBox(getPlayerName(getPlayerFromName(person)).." #FFFFFFdid not reach the Hunter yet.", source, 255, 255, 255,true) 
    elseif getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts") == 1 then 
        outputChatBox(getPlayerName(getPlayerFromName(person)).." #FFFFFFhas reached the Hunter #FF0000"..getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts").." #FFFFFFtime.", source, 255, 255, 255,true) 
    elseif getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts") > 1 then 
        outputChatBox(getPlayerName(getPlayerFromName(person)).." #FFFFFFhas reached the Hunter #FF0000"..getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts").." #FFFFFFtimes.", source, 255, 255, 255,true) 
    else 
        outputChatBox("Sytanx: /hunters [Player]", source, 255, 0, 0,false) 
    end 
end 
addCommandHandler("hunters", HunterInfo) 
  

When the hunter.counts is 0 it should display that player didn't reach hunter yet, and when player tries /hunter [person] it should show the same if they don't have hunter.

Its not working :/

Line 30 = line 9 btw

Posted

"getPlayerFromName(person)" - is using direct comparation between all player's and the gived name. So when you type in the name , you need to type the color cod's to.

If you name is #00ff00Me , and you type in Me , it will not find you bk you don't entered the color code.

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

Try this:

function HunterInfo ( source, _, person ) 
    local person = getPlayerFromName ( person ) 
    local account = getPlayerAccount ( source ) 
    if ( not person and not getAccountData ( account, "hunter.counts" ) ) then 
        outputChatBox ( "#FFFFFFYou did not reach the Hunter yet.", source, 255, 255, 255, true ) 
    elseif ( not person and getAccountData ( account, "hunter.counts" ) == 1 ) then 
        outputChatBox ( "#FFFFFFYou have reached the Hunter#FF0000 ".. getAccountData ( account, "hunter.counts" ) .." #FFFFFFtime.", source, 255, 255, 255, true ) 
    elseif ( not person and getAccountData ( account, "hunter.counts" ) > 1 ) then 
        outputChatBox ( "#FFFFFFYou have reached the Hunter#FF0000 ".. getAccountData ( account, "hunter.counts" ) .." #FFFFFFtimes.", source, 255, 255, 255, true ) 
    elseif ( not getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) ) then 
        outputChatBox ( getPlayerName ( person ) .." #FFFFFFdid not reach the Hunter yet.", source, 255, 255, 255, true ) 
    elseif ( getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) == 1 ) then 
        outputChatBox ( getPlayerName ( person ) .." #FFFFFFhas reached the Hunter #FF0000".. getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) .." #FFFFFFtime.", source, 255, 255, 255, true ) 
    elseif ( getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) > 1 ) then 
        outputChatBox ( getPlayerName ( person ) .." #FFFFFFhas reached the Hunter #FF0000".. getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) .." #FFFFFFtimes.", source, 255, 255, 255, true ) 
    else 
        outputChatBox ( "Sytanx: /hunters [Player]", source, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "hunters", HunterInfo ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Didn't work Snake.

I'm a C programmer and pretty new to Lua, what i found out that Lua got a weird thing on its language

== false

== 0

== false or 0 < This will never work on getAccountData

Not sure if its a bug or probably my mistake, thanks anyway

Posted
Didn't work Snake.

I'm a C programmer and pretty new to Lua, what i found out that Lua got a weird thing on its language

== false

== 0

== false or 0 < This will never work on getAccountData

Not sure if its a bug or probably my mistake, thanks anyway

in C/C++ false = 0 if you use it in "if" , in lua it's note .

Anyway :" getAccountData(....) or 0 " is working

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...