Spider Pork
-
Posts
60 -
Joined
-
Last visited
Posts posted by Spider Pork
-
-
Patience, Dont do anything stupid.
Just keep a low profile and hold your fire.
-
As far as I know, there is a MTA project for GTA:IV:?
-
What do you mean with "it doesn't work"?
Show us your code, as Uniqu3 said!
Also, did you add the script to meta.xml?
-
Another player for MTA, one less for SA-MP
LUA is way easier than PAWN, trust me. It took me only a week or two to learn it and it's actually fun.
-
Note, the ped has NO control states or anything, it is simply just spawned.
Don't think so. I guess the server might be running a fighting ped script or something?
-
-
Maybe toggleControl?
toggleControl(player, "fire", false)
-
It should be in MTA Root Directory\server\mods\deathmatch\resources
-
Can't see much point in creating water outside SA map, it's all water there anyway, isn't it?
Yea, but maybe water above the normal water level there? Like some small lakes or something. I guess that's what he meant.
-
Use createWater.
-
It works. Thanks a lot for your help.
-
Uhm... you forgot the addEventHandler function, trajik
But I guess you want it in a command, right? Then it should look something like this:
function command_makeStuff(player) local x, y, z = getElementPosition(player) createObject(2993, x, y, z, 120, 0, 0) outputChatBox("Party started", player, 0, 255, 0, true) end addCommandHandler("command", command_makeStuff)
-
I kinda knew it's because I call the function again. But how else can I find a good skin without calling the function again? If I just leave it, nothing will happen if it doesn't pass the checks.
-
Hello there!
Why is this function...
function setPlayerRandomSkin(player) randskin = math.random(288) if(isValidSkin(randskin) == true) then if(isRegimentSkin(randskin) == false) then local account = getPlayerAccount(player) setAccountData(account, "wwacc.skin", randskin) setElementModel(player, getAccountData(account, "wwacc.skin")) return getAccountData(account, "wwacc.skin") else setPlayerRandomSkin(player) end else setPlayerRandomSkin(player) end end
... returning me the "Stack overflow." error? What does it mean anyways?
-
This is kinda weird. The variable is always a number until I restart the server. Then it becomes a boolean (false)... I've output its value everywhere I set it and also created a command to see it. It always sends a number, but when I restart the server it messes up to a boolean. I've also rewritten the whole script, here's the new login/register/spawning/test command code:
function spawnHandler(posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension) local account = getPlayerAccount(source) if account == false then outputChatBox("Error: You have to log in to spawn.", source, 255, 0, 0) cancelEvent() elseif account ~= false then if getAccountData(account, "wwacc.skin") == false or getAccountData(account, "wwacc.skin") == nil then setAccountData(account, "wwacc.skin", 0) end if getAccountData(account, "wwacc.justDied") == true then triggerClientEvent("showGUI_deathSelect", getRootElement()) end setAccountData(account, "wwacc.timesSpawned", getAccountData(account, "wwacc.timesSpawned")+1) outputChatBox(tostring(getAccountData(account, "wwacc.timesSpawned")), source) end end addEventHandler("onPlayerSpawn", getRootElement(), spawnHandler) function command_test(playerSource, commandName, ...) outputChatBox(tostring(getAccountData(getPlayerAccount(playerSource), "wwacc.timesSpawned"))) end addCommandHandler("test", command_test) function loginHandler(player, username, password) local account = getAccount(username, password) if account ~= false then if logIn(player, account, password) == true then triggerClientEvent("hideLoginWindow", player) setPlayerName(player, username) outputChatBox(tostring(getAccountData(account, "wwacc.timesSpawned")), source) if getAccountData(account, "wwacc.justDied") == true then triggerClientEvent("showGUI_deathSelect", getRootElement()) elseif getAccountData(account, "wwacc.needsSelect") == true then triggerClientEvent("showGUI_teamSelect", player) elseif getAccountData(account, "wwacc.timesSpawned") > 0 then fadeCamera(player, true) spawnPlayer(player, getAccountData(account, "wwacc.xPos"), getAccountData(account, "wwacc.yPos"), getAccountData(account, "wwacc.zPos"), getAccountData(account, "wwacc.angle"), getAccountData(account, "wwacc.skin"), getAccountData(account, "wwacc.interior")) setCameraTarget(player, player) elseif getAccountData(account, "wwacc.timesSpawned") == 0 then if getAccountData(account, "wwacc.team") == 1 then fadeCamera(player, true) spawnPlayer(player, 245.9324, 1990.0793, 17.6406, 180, 287, 0, 0) setElementInterior(player, 0) setElementHealth(player, 100) setPedArmor(player, 0) setCameraTarget(player, player) elseif getAccountData(account, "wwacc.team") == 2 then fadeCamera(player, true) spawnPlayer(player, -2681.7974, 2151.6648, 55.8125, 180, 100, 0, 0) setElementInterior(player, 0) setElementHealth(player, 100) setPedArmor(player, 0) setCameraTarget(player, player) end end else outputChatBox("Error: Invalid username or password", source, 255, 0, 0) end else outputChatBox("Error: An account with that username doesn't exist.", source, 255, 0, 0) end end addEvent("onLogin", true) addEventHandler("onLogin", getRootElement(), loginHandler) function registerHandler(player, username, password) local account = getAccount(username) if account ~= false then if logIn(player, account, password) then triggerClientEvent("hideLoginWindow", player) setPlayerName(player, username) outputChatBox("You have been successfully logged in.", player) else outputChatBox("Error: Invalid password.", player, 255, 0, 0) end else account = addAccount(username, password) setAccountData(account, "wwacc.team", 0) setAccountData(account, "wwacc.needsSelect", true) setAccountData(account, "wwacc.waitingMoney", 0) setAccountData(account, "wwacc.money", 0) setAccountData(account, "wwacc.adminLevel", 0) setAccountData(account, "wwacc.muted", false) setAccountData(account, "wwacc.regimentMember", 0) setAccountData(account, "wwacc.regimentLeader", 0) setAccountData(account, "wwacc.hasRadio", false) setAccountData(account, "wwacc.radioFreq", 0) setAccountData(account, "wwacc.timesSpawned", 0) if logIn(player, account, password) == true then triggerClientEvent("hideLoginWindow", player) triggerClientEvent("showGUI_teamSelect", player) setPlayerName(player, username) outputChatBox("You have been successfully logged in.", player) else outputChatBox("Error: Fatal error occured. Please contact an administrator for help.", player, 255, 0, 0) end end end addEvent("onRegister", true) addEventHandler("onRegister", getRootElement(), registerHandler)
What am I doing wrong?
-
As i said its "getElementData"
not "loadPlayerData"
What if he created his own function ?
-
-
Create a checkpoint server-side. Then create a client-side event with the code to delete the checkpoint then server-side trigger it when you want to delete the checkpoint. Maybe that'll work?
-
There's something wrong in gm_client. Show us your code.
-
Yea, just use guiSetVisible every second to hide and re-show the health bar.
-
guiSetVisible in a timer? When your health is low, your normal health bar dissappears and appears back each second or so.
-
First, get both positions then use this function:
https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D
-
I have experimented some stuff with tonumber.
This... is Sparta!!
tonumber(getAccountData(account, "wwacc.timesSpawned"))
... returns nil for some reason. Anyone knows why?
-
I removed any sign of a boolean on that variable in my script. It still returns "attempt to compare number with boolean" on the same line. If I use tonumber(), it will somehow return nil.
onPlayerWeaponSwitch doesn't trigger.
in Scripting
Posted
Use onClientPlayerWeaponSwitch...
It's a client-side event and it's more efficient.