Jump to content

Jumba'

Members
  • Posts

    254
  • Joined

  • Last visited

Everything posted by Jumba'

  1. Well, in the 'startMission' function you could put the event handler in the "setElementData" (or the trigger for a client event) so you'll be sure that the data has already been synced.
  2. Well, in the 'startMission' function you could put the event handler in the "setElementData" (or the trigger for a client event) so you'll be sure that the data has already been synced.
  3. mirc scripting .. *shudders* Lua is much more easier, just take a look at it, you won't even think about mta:ma again.
  4. mirc scripting .. *shudders* Lua is much more easier, just take a look at it, you won't even think about mta:ma again.
  5. mmkay, I'll just have to skip this idea then. Thanks for all the help though.
  6. mmkay, I'll just have to skip this idea then. Thanks for all the help though.
  7. There isn't any, I've checked the whole wiki but I couldn't find any, I guess you'll just have to write one.
  8. There isn't any, I've checked the whole wiki but I couldn't find any, I guess you'll just have to write one.
  9. Using this echo " Country code : " . $ip_data['ip'] . " "; echo "Country name : " . $ip_data['country_name'] . " "; echo "Region name : " . $ip_data['region_name'] . " "; echo "City : " . $ip_data['city'] . " "; echo "Zip/postal code : " . $ip_data['zippostalcode'] . " "; echo "Latitude : " . $ip_data['latitude'] . " "; echo "Longitude : " . $ip_data['longitude'] . " "; echo "Timezone : " . $ip_data['timezone'] . " "; echo "GmtOffset : " . $ip_data['gmtoffset'] . " "; echo "DstOffset : " . $ip_data['dstoffset'] . " "; returns this. I've checked, it doesn't return an array. I've also tried retrieving the string using $ip_data['country_name']['0'] (and other variants), but it returns null.
  10. Using this echo " Country code : " . $ip_data['ip'] . " "; echo "Country name : " . $ip_data['country_name'] . " "; echo "Region name : " . $ip_data['region_name'] . " "; echo "City : " . $ip_data['city'] . " "; echo "Zip/postal code : " . $ip_data['zippostalcode'] . " "; echo "Latitude : " . $ip_data['latitude'] . " "; echo "Longitude : " . $ip_data['longitude'] . " "; echo "Timezone : " . $ip_data['timezone'] . " "; echo "GmtOffset : " . $ip_data['gmtoffset'] . " "; echo "DstOffset : " . $ip_data['dstoffset'] . " "; returns this. I've checked, it doesn't return an array. I've also tried retrieving the string using $ip_data['country_name']['0'] (and other variants), but it returns null.
  11. Oh, sorry, I forgot to change the code, I just ran it with $ip_data to get the thing where it shows the json objects, when running it to connect with the server I use the $ip_data['ip'], $ip_data['country_name'] etc. This: mta::doReturn( $ip_data['ip'], $ip_data['country_name'], $ip_data['country_code'] ); Returns this: As you can see, only the ip is returned as a string, not the other stuff, and it's not a problem with the API I'm using since using "echo $ip_date['country_name'] works fine.
  12. Oh, sorry, I forgot to change the code, I just ran it with $ip_data to get the thing where it shows the json objects, when running it to connect with the server I use the $ip_data['ip'], $ip_data['country_name'] etc. This: mta::doReturn( $ip_data['ip'], $ip_data['country_name'], $ip_data['country_code'] ); Returns this: As you can see, only the ip is returned as a string, not the other stuff, and it's not a problem with the API I'm using since using "echo $ip_date['country_name'] works fine.
  13. Hi, so uhm, I was trying to use the PHP SDK to get some IP geolocation information and sending it back to the server, but I ran into a problem I could not solve. Whenever I use the "doReturn" function I got errors ingame, upon investigating I realized that tables were being sent, instead of strings. Directly running the php script in the server returned this. [{"ip":"74.125.45.100","country_code":{"0":"US"},"country_name":{"0":"United States"},"region_name":{"0":"California"},"city":{"0":"Mountain View"},"zippostalcode":{"0":"94043"},"latitude":{"0":"37.4192"},"longitude":{"0":"-122.057"},"timezone":{"0":"-8"},"gmtoffset":{"0":"-8"},"dstoffset":{"0":"-7"}}] Only the IP is successfully sent to the server, the rest all appear as tables, but when I do "#table" it returns 0, and looping over the tables don't return any results either. I asked someone who knew a bit more of PHP then me and he said that "country_code":{"0":"US"} is a JSON object, but I thought the PHP SDK returns it as a normal string? Either way, no matter what I do it still fails This is my PHP file btw. <?php include ( "mta_sdk.php" ); function locateIp($ip){ $d = file_get_contents("http://www.ipinfodb.com/ip_query.php?ip=$ip&output=xml"); //Use backup server if cannot make a connection if (!$d){ $backup = file_get_contents("http://backup.ipinfodb.com/ip_query.php?ip=$ip&output=xml"); $answer = new SimpleXMLElement($backup); if (!$backup) return false; // Failed to open connection }else{ $answer = new SimpleXMLElement($d); } $country_code = $answer->CountryCode; $country_name = $answer->CountryName; $region_name = $answer->RegionName; $city = $answer->City; $zippostalcode = $answer->ZipPostalCode; $latitude = $answer->Latitude; $longitude = $answer->Longitude; $timezone = $answer->Timezone; $gmtoffset = $answer->Gmtoffset; $dstoffset = $answer->Dstoffset; //Return the data as an array return array('ip' => $ip, 'country_code' => $country_code, 'country_name' => $country_name, 'region_name' => $region_name, 'city' => $city, 'zippostalcode' => $zippostalcode, 'latitude' => $latitude, 'longitude' => $longitude, 'timezone' => $timezone, 'gmtoffset' => $gmtoffset, 'dstoffset' => $dstoffset); } //$input = mta::getInput(); //$ip_data = locateIp($input); $ip = "74.125.45.100"; $ip_data = locateIp($ip); mta::doReturn( $ip_data ); echo " Country code : " . $ip_data['ip'] . " "; echo "Country name : " . $ip_data['country_name'] . " "; echo "Region name : " . $ip_data['region_name'] . " "; echo "City : " . $ip_data['city'] . " "; echo "Zip/postal code : " . $ip_data['zippostalcode'] . " "; echo "Latitude : " . $ip_data['latitude'] . " "; echo "Longitude : " . $ip_data['longitude'] . " "; echo "Timezone : " . $ip_data['timezone'] . " "; echo "GmtOffset : " . $ip_data['gmtoffset'] . " "; echo "DstOffset : " . $ip_data['dstoffset'] . " "; ?> The lower part is commented out when I'm using callRemote, so that's not the problem. And that returns So it's something with the SDK, but I can't figure out what.
  14. Hi, so uhm, I was trying to use the PHP SDK to get some IP geolocation information and sending it back to the server, but I ran into a problem I could not solve. Whenever I use the "doReturn" function I got errors ingame, upon investigating I realized that tables were being sent, instead of strings. Directly running the php script in the server returned this. [{"ip":"74.125.45.100","country_code":{"0":"US"},"country_name":{"0":"United States"},"region_name":{"0":"California"},"city":{"0":"Mountain View"},"zippostalcode":{"0":"94043"},"latitude":{"0":"37.4192"},"longitude":{"0":"-122.057"},"timezone":{"0":"-8"},"gmtoffset":{"0":"-8"},"dstoffset":{"0":"-7"}}] Only the IP is successfully sent to the server, the rest all appear as tables, but when I do "#table" it returns 0, and looping over the tables don't return any results either. I asked someone who knew a bit more of PHP then me and he said that "country_code":{"0":"US"} is a JSON object, but I thought the PHP SDK returns it as a normal string? Either way, no matter what I do it still fails This is my PHP file btw. <?php include ( "mta_sdk.php" ); function locateIp($ip){ $d = file_get_contents("http://www.ipinfodb.com/ip_query.php?ip=$ip&output=xml"); //Use backup server if cannot make a connection if (!$d){ $backup = file_get_contents("http://backup.ipinfodb.com/ip_query.php?ip=$ip&output=xml"); $answer = new SimpleXMLElement($backup); if (!$backup) return false; // Failed to open connection }else{ $answer = new SimpleXMLElement($d); } $country_code = $answer->CountryCode; $country_name = $answer->CountryName; $region_name = $answer->RegionName; $city = $answer->City; $zippostalcode = $answer->ZipPostalCode; $latitude = $answer->Latitude; $longitude = $answer->Longitude; $timezone = $answer->Timezone; $gmtoffset = $answer->Gmtoffset; $dstoffset = $answer->Dstoffset; //Return the data as an array return array('ip' => $ip, 'country_code' => $country_code, 'country_name' => $country_name, 'region_name' => $region_name, 'city' => $city, 'zippostalcode' => $zippostalcode, 'latitude' => $latitude, 'longitude' => $longitude, 'timezone' => $timezone, 'gmtoffset' => $gmtoffset, 'dstoffset' => $dstoffset); } //$input = mta::getInput(); //$ip_data = locateIp($input); $ip = "74.125.45.100"; $ip_data = locateIp($ip); mta::doReturn( $ip_data ); echo " Country code : " . $ip_data['ip'] . " "; echo "Country name : " . $ip_data['country_name'] . " "; echo "Region name : " . $ip_data['region_name'] . " "; echo "City : " . $ip_data['city'] . " "; echo "Zip/postal code : " . $ip_data['zippostalcode'] . " "; echo "Latitude : " . $ip_data['latitude'] . " "; echo "Longitude : " . $ip_data['longitude'] . " "; echo "Timezone : " . $ip_data['timezone'] . " "; echo "GmtOffset : " . $ip_data['gmtoffset'] . " "; echo "DstOffset : " . $ip_data['dstoffset'] . " "; ?> The lower part is commented out when I'm using callRemote, so that's not the problem. And that returns So it's something with the SDK, but I can't figure out what.
  15. Jumba'

    Player ids.

    Aaah, that explains it. Thanks! =D
  16. Jumba'

    Player ids.

    Aaah, that explains it. Thanks! =D
  17. Jumba'

    Player ids.

    *facepalm* The thing is, when a player disconnects I want the the script to set his id as available, but, here's an example of how the table is at this moment, with only me ingame. 1 false 2 false 3 true 4 false 5 true 6 false 7 true 8 false 9 true 10 true 11 true 12 true 13 true 14 true 15 true 16 true 17 true 18 true 19 true 20 true 21 true 22 true 23 true 24 true 25 true 26 true 27 true 28 true 29 true 30 true 31 true 32 true 33 true 34 true 35 true 36 true 37 true 38 true 39 true 1. The table gets larger 2. Some id's are set to 'false' for some reason.
  18. Jumba'

    Player ids.

    *facepalm* The thing is, when a player disconnects I want the the script to set his id as available, but, here's an example of how the table is at this moment, with only me ingame. 1 false2 false3 true4 false5 true6 false7 true8 false9 true10 true11 true12 true13 true14 true15 true16 true17 true18 true19 true20 true21 true22 true23 true24 true25 true26 true27 true28 true29 true30 true31 true32 true33 true34 true35 true36 true37 true38 true39 true 1. The table gets larger 2. Some id's are set to 'false' for some reason.
  19. I was talking to them today and I remember them mentioning a stats script and a registration script.. but I'm not sure if that's all they need
  20. I was talking to them today and I remember them mentioning a stats script and a registration script.. but I'm not sure if that's all they need
  21. Jumba'

    Player ids.

    Hi, I've been trying to figure out a way to assign a unique id to each player, but I can't seem to get it right. I've tried everything I could think of, but I either get duplicate id's, or the old id's don't get removed, etc. This is the one I'm using right now, which doesn't work.. But I'm sure there's a way smaller/easier way to do this, but I can't figure it out. The problem with it is that it does't take out all the old id's from the 'availableID' table. I don't need the whole script already written, just instructions on how I can make it shorter (and maybe without having to use the availableID table?) and I'll try to do it myself. function Init () i = 1 while i < getMaxPlayers() do table.insert ( availableID, i, true ) i = i + 1 end for k, player in ipairs ( getElementsByType ( "player" ) ) do assignPlayerID ( player ) end end function assignPlayerID ( player ) local s_id = 1 while ( isIDAvailable ( s_id ) == false ) do s_id = s_id + 1 end setElementData ( player, "ID", s_id ) table.insert ( availableID, s_id, false ) end function isIDAvailable ( id ) if ( availableID[id] ) then return true else return false end end function onLeave () local id = getElementData ( source, "ID" ) table.insert ( availableID, id, true ) removeElementData ( source, "ID" ) end
  22. Jumba'

    Player ids.

    Hi, I've been trying to figure out a way to assign a unique id to each player, but I can't seem to get it right. I've tried everything I could think of, but I either get duplicate id's, or the old id's don't get removed, etc. This is the one I'm using right now, which doesn't work.. But I'm sure there's a way smaller/easier way to do this, but I can't figure it out. The problem with it is that it does't take out all the old id's from the 'availableID' table. I don't need the whole script already written, just instructions on how I can make it shorter (and maybe without having to use the availableID table?) and I'll try to do it myself. function Init () i = 1 while i < getMaxPlayers() do table.insert ( availableID, i, true ) i = i + 1 end for k, player in ipairs ( getElementsByType ( "player" ) ) do assignPlayerID ( player ) end end function assignPlayerID ( player ) local s_id = 1 while ( isIDAvailable ( s_id ) == false ) do s_id = s_id + 1 end setElementData ( player, "ID", s_id ) table.insert ( availableID, s_id, false ) end function isIDAvailable ( id ) if ( availableID[id] ) then return true else return false end end function onLeave () local id = getElementData ( source, "ID" ) table.insert ( availableID, id, true ) removeElementData ( source, "ID" ) end
  23. Jumba'

    Admin system?

    https://wiki.multitheftauto.com/wiki/Admin
×
×
  • Create New...