SkatCh Posted August 27, 2014 Posted August 27, 2014 hi guys please i need some help here i create a vip system and i got some warinings here : just i want when i restart the resource evrey one will get his VIP status : addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( getAccountName ( p ) ) then <------------- this line if ( getAccountData ( getAccountName ( p ), "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end ); Warning : bad argument @ 'getAccountName' [expected account at argument 1 , got player] Failure is simply an opportunity to begin again more intelligently - Henry Ford
Saml1er Posted August 27, 2014 Posted August 27, 2014 First you must get the player's account using getPlayerAccount and then use getAccountName local ranp = getRandomPlayer() if ranp then local acc = getPlayerAccount (ranp ) local accName = getAccountName (acc) -- You got his account name else outputChatBox ("Could not find a random player") end
SkatCh Posted August 27, 2014 Author Posted August 27, 2014 yes bro me too i think it's right but i try didn't work can you fix it please: addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if ( getAccountName ( account ) ) then <------------- this line if ( getAccountData ( getAccountName ( p ), "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end ); Failure is simply an opportunity to begin again more intelligently - Henry Ford
Anubhav Posted August 27, 2014 Posted August 27, 2014 addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if not ( isGuestAccount( account ) ) then if ( getAccountData ( p , "vip" ) ) then setElementData ( p, "vip", true ) setElementData ( p, "vip.time", tonumber ( getAccountData ( p, "vip.time" ) ) ) startVip ( p ) end end end end ) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
xeon17 Posted August 27, 2014 Posted August 27, 2014 addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if (account ) then if ( getAccountName ( account ) ) then <------------- this line if ( getAccountData ( p , "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end ); A unique GangWar gamemode waiting for you!Click here for more information.
Anubhav Posted August 27, 2014 Posted August 27, 2014 addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if (account ) then if ( getAccountName ( account ) ) then <------------- this line if ( getAccountData ( p , "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end ); Din't you copied my code? See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
xeon17 Posted August 27, 2014 Posted August 27, 2014 by Anubhav on 27 Aug 2014, 12:48 by XeoN- on 27 Aug 2014, 12:49 Keep calm , we posted in the same time nobody copied your code. By the way , my code isn't 100% like your. A unique GangWar gamemode waiting for you!Click here for more information.
SkatCh Posted August 27, 2014 Author Posted August 27, 2014 nvm keep calm guys. anyways i will try it . Failure is simply an opportunity to begin again more intelligently - Henry Ford
Anubhav Posted August 27, 2014 Posted August 27, 2014 addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if (account ) then if ( getAccountName ( account ) ) then <------------- this line if ( getAccountData ( p , "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end ); Din't you copied my code? Are you mad? keep calm 1 reply is enough kid. See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
50p Posted August 27, 2014 Posted August 27, 2014 There is no need to fight over simple stuff. Copying the code? The code that author of the topic needed help with? Cool down. Don't go offtopic. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
Anubhav Posted August 27, 2014 Posted August 27, 2014 I've reported him instead of posting shits.. I am realy sorry if I did something wrong here See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Karoffe Posted August 27, 2014 Posted August 27, 2014 Well, how could you can get an account data of a player element ? you should pass the account instead addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() , function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if not ( isGuestAccount( account ) ) then --if ( getAccountData ( p , "vip" ) ) then if ( getAccountData ( account , "vip" ) ) setElementData ( p, "vip", true ) setElementData ( p, "vip.time", tonumber ( getAccountData ( p, "vip.time" ) ) ) startVip ( p ) end end end end )
SkatCh Posted August 27, 2014 Author Posted August 27, 2014 guys i alredy fixed it thx every one for help . topic can be locked. Failure is simply an opportunity to begin again more intelligently - Henry Ford
Recommended Posts