CTCCoco Posted February 23, 2010 Share Posted February 23, 2010 How I can create something like RegistroPaso1[MAX_PLAYERS] = 0; and you use RegistroPaso1[playerid] = 0; on SA:MP but in MTA? Thanks. Link to comment
Jumba' Posted February 24, 2010 Share Posted February 24, 2010 How I can create something like RegistroPaso1[MAX_PLAYERS] = 0; and you use RegistroPaso1[playerid] = 0; on SA:MP but in MTA?Thanks. I'm not very good in PAWN but if I'm correct you're defining the table size with "RegistroPaso1[MAX_PLAYERS] = 0". In lua that's not neccesary, you just create a table using "RegistroPaso1 = { }", the size does not matter, it dynamically adapts itself as more values are added. Also, in MTA players don't have id's, you'll have to script that, they do all have a unique key, each player is an element. So in lua RegistroPaso1[playerid] = 0; would be RegistroPaso1[element] = { } Here's an example. RegistroPaso1 = { } function blaBla( source, command ) RegistroPaso1[source] = { } end addCommandHandler ( "bla", blaBla ) I recommend reading this: http://nixstaller.berlios.de/manual/0.2/nixstaller_9.html Link to comment
CTCCoco Posted February 24, 2010 Author Share Posted February 24, 2010 How I can create something like RegistroPaso1[MAX_PLAYERS] = 0; and you use RegistroPaso1[playerid] = 0; on SA:MP but in MTA?Thanks. I'm not very good in PAWN but if I'm correct you're defining the table size with "RegistroPaso1[MAX_PLAYERS] = 0". In lua that's not neccesary, you just create a table using "RegistroPaso1 = { }", the size does not matter, it dynamically adapts itself as more values are added. Also, in MTA players don't have id's, you'll have to script that, they do all have a unique key, each player is an element. So in lua RegistroPaso1[playerid] = 0; would be RegistroPaso1[element] = { } Here's an example. RegistroPaso1 = { } function blaBla( source, command ) RegistroPaso1[source] = { } end addCommandHandler ( "bla", blaBla ) I recommend reading this: http://nixstaller.berlios.de/manual/0.2/nixstaller_9.html In Pawn you can create RegistroPaso1 = 0; but it is only a var for all players. I want do a variable that a player can have == 1 and other player have == 0. I mean: CTC_Coco -> RegistroPaso1 == 1 Other_Player -> RegistroPaso1 == 6 Other -> RegistroPaso1 == 0 etc etc. Please help me and thanks. Link to comment
Aibo Posted February 24, 2010 Share Posted February 24, 2010 (edited) it's called a table, you create it somewhere with RegistroPaso = { } later you can set/get value from it with RegistroPaso['key'] = value, like: addCommandHandler("setvalue", function (player, command, value) if value then RegistroPaso[player] = value end end ) addCommandHandler("getvalue", function (player) if RegistroPaso[player] then outputChatBox("Your RegistroPaso value: " .. RegistroPaso[player], player) else outputChatBox("Your RegistroPaso value is not set", player) end end ) http://www.lua.org/pil/2.5.html Edited February 24, 2010 by Guest Link to comment
CTCCoco Posted February 24, 2010 Author Share Posted February 24, 2010 Thanks for the help . 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