Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Xmair

#1
Open VC in Single Player and change the resolution to 32 bit mode.
#2
Thank you AdTec, these are great features. However, are there any workarounds to hide _mem.xml files for HTTP downloads?
#3
Servers / Re: [0.4] Vice City Cops & Robbers
May 18, 2024, 02:32 PM
The server IP has been changed to 81.17.101.189:8192
#4
Script Showroom / Re: Dipeos command
Mar 09, 2024, 06:56 PM
Quote from: PSL on Mar 09, 2024, 08:11 AMThe following code may help you
DiePos<-{}; //Create a table where you can store coordinates
function onPlayerSpawn(player)
{
if(DiePos.rawin(player.ID)) //If an ID exists in the table
    {
        player.Pos=DiePos.rawget(player.ID); //Restores the player to death point
        DiePos.rawdelete(player.ID); //Delete coordinates after recovery
    }
}
function onPlayerDeath(player,reason)
{
DiePos.rawset(player.ID,player.Pos); //After the player dies, the ID is used as the search object, and the death coordinates are stored in the table
}

You should also remove the player data once the player disconnects.
function onPlayerPart(player, reason) {
    if (DiePos.rawin(player.ID))
        DiePos.rawdelete(player.ID);
}
#5
General Discussion / Re: Free 90 days VPS
Sep 12, 2023, 05:46 AM
Quote from: vitovc on Sep 11, 2023, 12:40 PMin my point of view clouds are dangerous in terms of unexpected bills, especially if you are using credit card. free trial is a bait
Agreed. Cloud is the biggest scam lol. There are so many hidden bills
#6
Replace
!player.Vehicle
with
!vehicle.Driver
#7
In sqmod.ini under [Scripts]:
Execute=path/to/file.nut
# OR
Compile=path/to/file.nut

Also be advised, if you are trying to use both the official plugin and SqMod in one server, it is not possible. You have to stick with one.
#8
You have a typo in your code. It is supposed to be DisconnectSQL, not DiscconectSQL
#9
Quote from: habi on Jul 11, 2023, 04:35 AMyou give it by adding ammo to current ammo:
player.SetWeapon(13, 10 + player.GetAmmoAtSlot(2));
For rocket, slot is 7.
Better version:
player.GiveWeapon(13, 10);
#10
Quote from: Nihongo^ on Jun 27, 2023, 08:30 AMThank you so much xmair for giving me such an amazing idea

just one more thing, how do now i select different columns in a different table of the same person?

Like picking IP from Accounts and picking UID from Alias table

Thank you
Look into JOIN queries
#11
Community Plugins / Re: Console Color Plugin
Jun 29, 2023, 12:54 PM
Quote from: habi on Jun 28, 2023, 07:04 PMHowever the "[SCRIPT]" part remain.
Its possible to remove the [SCRIPT] tag by doing something like this:

print("\rTest 123");

However some parts might remain if the total length is less than that of [SCRIPT] but you can write a wrapper function to fill the rest of the parts with spaces
#12
You generally don't want to query 3 times if you are querying from the same table. What could you do instead is select multiple columns in a single query. It is also good practice to escape any input you take from the user to prevent SQL injection.

The main problem you are facing right now is that you are not retrieving the column data for the query. QuerySQL doesn't return just the result but an object which contains information about the query. Ideally, something like this would be a half-decent approach:

local accDetails = QuerySQL(db, format("SELECT IP, UID, UID2 FROM Accounts WHERE Name = '%s', escapeSQLString(plr)));
if (accDetails == null) // handle invalid nickname
else {
    QuerySQL(db, format("INSERT INTO TempBans (Name, UID, UID2, IP, Time, ExpireTime, TimeExpireRatio, Admin, Reason) VALUES ('%s', '%s', '%s', '%s', %i, %i, %s, %s, %s)", escapeSQLString(plr), GetSQLColumnData(accDetails, 1), GetSQLColumnData(accDetails, 2), GetSQLColumnData(accDetails, 0), time(), calc, expire, player.Name, escapeSQLString(reason)));
}
#13
Quote from: habi on May 19, 2023, 04:47 PMi disagree

If you use function FindPlayer in console, each time it appears you are getting a new instance. So the property will be false.

This is the same problem why 'false' is printed on console after spawning:
QuoteCPlayer.rawnewmember("SpawnProtection", false);

function onPlayerSpawn(player) {
    player.SpawnProtection = true;
    player.Immunity = 31;
    MessagePlayer("You have spawn protection for five seconds", player);
    NewTimer("TurnOffSpawnProtection", 5000, 1, player.ID);
}
 
function TurnOffSpawnProtection(player) {
    if ((player = FindPlayer(player)) != null) {
        print(player.SpawnProtection);
      player.SpawnProtection = false;
        player.Immunity = 0;
    }
}


I did not know of the official plugin's behavior in this regard. In SqMod we have a much better and decent approach to this whole idea, we are provided with a "Data" member of every instance (which is basically a table). One more reason to just shift :-X
#14
There's another way to do this:

CPlayer.rawnewmember("<member name>", <default val>);

Quote from: http://squirrel-lang.org/doc/squirrel3.htmlrawnewmember(key,val,[attrs],[bstatic])

sets/adds the slot 'key' with the value 'val' and attributes 'attrs'.If bstatic is true the slot will be added as static. If the slot does not exists , it will be created. It doesn't invoke any metamethod.

Ultimately, all of the code written above could be changed to a simple:

CPlayer.rawnewmember("SpawnProtection", false);

function onPlayerSpawn(player) {
    player.SpawnProtection = true;
    player.Immunity = 31;
    MessagePlayer("You have spawn protection for five seconds", player);
    NewTimer("TurnOffSpawnProtection", 5000, 1, player.ID);
}
   
function TurnOffSpawnProtection(player) {
    if ((player = FindPlayer(player)) != null) {
        player.SpawnProtection = false;
        player.Immunity = 0;
    }
}
#15
I will fix it in a few days and reupload it.