Spajk Posted May 13, 2011 Share Posted May 13, 2011 Ok, a am new to LUA and I need help. Can someone tell me if I have some "code" mistake function free( player ) setPlayerWantedLevel ( player, 0 ) end function playerDamage ( attacker, weapon, bodypart, loss ) --when a player is damaged if ( bodypart == 7 or bodypart==8 ) then setPedAnimation( source, "ped", "WOMAN_walknorm", 5000) end local swat = getTeamFromName("SWAT") local fbi = getTeamFromName("FBI") local officer = getTeamFromName("Police officer") local tc = getTeamFromName("Traffic control") local team = getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( source ) If ( weapon == 3 ) then if(team==swat or team==fbi or team==officer or team==tc) then local stars = getPlayerWantedLevel ( source ) local time - stars*10 setAccountData ( account, "rpg.jtime", time ) setTimer(free,time*1000,1,source) end end end function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getPlayerWantedLevel ( source ) setAccountData ( playeraccount, "rpg.wstars", playerstars ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getAccountData ( playeraccount, "rpg.wstars" ) if ( playerstars ) then setPlayerWantedLevel ( source, playerstars ) end end end function registeracc( playerSource, commandName, user, pass ) local account = getPlayerAccount ( playerSource ) if isGuestAccount ( account ) then If getAccount( user ) outputChatBox ( "Account name alreaady exist.", playerSource ) else addAccount( user, pass ) ` outputChatBox ( "Account" ..user.. "successfully created with password" ..pass.. ".", playerSource ) end else outputChatBox ( "You already have account.", playerSource ) end end addCommandHandler ( "register", registeracc ) addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
Castillo Posted May 13, 2011 Share Posted May 13, 2011 Yes, you do. function free( player ) setPlayerWantedLevel ( player, 0 ) end function playerDamage ( attacker, weapon, bodypart, loss ) --when a player is damaged if ( bodypart == 7 or bodypart==8 ) then setPedAnimation( source, "ped", "WOMAN_walknorm", 5000) end local swat = getTeamFromName("SWAT") local fbi = getTeamFromName("FBI") local officer = getTeamFromName("Police officer") local tc = getTeamFromName("Traffic control") local team = getPlayerTeam( source ) if ( weapon == 3 ) then -- It's not If, it's if, with lowercase. if(team==swat or team==fbi or team==officer or team==tc) then local stars = getPlayerWantedLevel ( source ) local time - stars*10 setAccountData ( account, "rpg.jtime", time ) setTimer(free,time*1000,1,source) end end end function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getPlayerWantedLevel ( source ) setAccountData ( playeraccount, "rpg.wstars", playerstars ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getAccountData ( playeraccount, "rpg.wstars" ) if ( playerstars ) then setPlayerWantedLevel ( source, playerstars ) end end end function registeracc( playerSource, commandName, user, pass ) local account = getPlayerAccount ( playerSource ) if isGuestAccount ( account ) then If getAccount( user ) outputChatBox ( "Account name alreaady exist.", playerSource ) else addAccount( user, pass ) ` outputChatBox ( "Account" ..user.. "successfully created with password" ..pass.. ".", playerSource ) end else outputChatBox ( "You already have account.", playerSource ) end end addCommandHandler ( "register", registeracc ) addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Apart from that, i think nothing else, busy to check it all. Link to comment
Aibo Posted May 13, 2011 Share Posted May 13, 2011 if ( weapon == 3 ) then -- It's not If, it's if, with lowercase. if (team==swat or team==fbi or team==officer or team==tc) then local stars = getPlayerWantedLevel ( source ) --[[>]] local time = stars*10 -- time =, not time - --[[>]] setAccountData(account, "rpg.jtime", time) -- is account variable set? setTimer(free,time*1000,1,source) end end end function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getPlayerWantedLevel ( source ) setAccountData ( playeraccount, "rpg.wstars", playerstars ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerstars = getAccountData ( playeraccount, "rpg.wstars" ) if ( playerstars ) then setPlayerWantedLevel ( source, playerstars ) end end end function registeracc( playerSource, commandName, user, pass ) local account = getPlayerAccount ( playerSource ) if isGuestAccount ( account ) then --[[>]] if getAccount( user ) then -- same thing with if, not If, also 'then' was missing outputChatBox ( "Account name already exists.", playerSource ) else addAccount( user, pass ) ` outputChatBox ( "Account " ..user.. " successfully created with password " ..pass.. ".", playerSource ) end else outputChatBox ( "You already have account.", playerSource ) end end addCommandHandler ( "register", registeracc ) addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
Spajk Posted May 13, 2011 Author Share Posted May 13, 2011 thank you very much I don't understand this: --[[>]] setAccountData(account, "rpg.jtime", time) -- is account variable set? Link to comment
Aibo Posted May 13, 2011 Share Posted May 13, 2011 thank you very much I don't understand this: --[[>]] setAccountData(account, "rpg.jtime", time) -- is account variable set? are you sure that "account" is an account? i mean, maybe you forgot something like "local account = getPlayerAccount(source)" Link to comment
Spajk Posted May 13, 2011 Author Share Posted May 13, 2011 thank you very much I don't understand this: --[[>]] setAccountData(account, "rpg.jtime", time) -- is account variable set? are you sure that "account" is an account? i mean, maybe you forgot something like "local account = getPlayerAccount(source)" thanks on that too, I forgot to add that Link to comment
Spajk Posted May 14, 2011 Author Share Posted May 14, 2011 I know that this is a Double post but... Will this event( https://wiki.multitheftauto.com/wiki/OnP ... hicleEnter ) return a nil value for "jacked" if none is jacked ? Link to comment
karlis Posted May 14, 2011 Share Posted May 14, 2011 I know that this is a Double post but...Will this event( https://wiki.multitheftauto.com/wiki/OnP ... hicleEnter ) return a nil value for "jacked" if none is jacked ? propably false, but may be nil also Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now