Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About xxldoener

  • Rank
  1. I think that is not what I want. I want to receive a message that says "Invalid target specified" if the target player is not online, but I want to spawn a vehicle next to the player who entred the command if no target is specified. For example, I am player1 and player2 is also online. If I enter spawnvehicle player3 500 - A message should appear telling "Invalid target specified" If I enter spawnvehicle 500 - A Vehicle with the ID 500 should appear next to me (being the player who entered the command)
  2. So I already got my spawnvehicle-script to work. It works with spawnvehicle targetname vehicleid. However, I wanted to add a function so that if you don't specify a target, the person who enters the command becomes the target. But somehow it doesn't work, I get the error BadArgument@getPlayerFromName in line 10, which means that the entry in line 5 doesn't work either. What am I doing wrong? function spawnvehicle (thePlayer, commandname, target, vehicleid) if not vehicleid then if tonumber (target) then vehicleid = tonumber (target) target = (thePlayer) else outputChatBox("Invalid Veh
  3. Thank you, I did have the first argument before but removed it in hope it wold change anything ^^ the "tonumber" was the one i was looking for, thank you
  4. I wrote a script to Blow a vehicle a player is in by entering blowplayer *playername* However, this also blows all other cars spawned by that player, even if the player is not in them. How can I make that only the car the player is using right now is blown? function blowplayer (thePlayer, commandname, target) local targetp = getPlayerFromName (target) local root = getRootElement (targetp) if ( targetp ) then -- Wenn Spieler existiert und in Auto if getPedOccupiedVehicle(targetp) then blowVehicle ( root ) else outputChatBox("The selected Player is not in a vehicle", thePlayer) end
  5. Hey, I just wanted to program a give-car-script. Here's my code function givevehicle1 (commandname, target, vehicleid) local targetp = getPlayerFromName (target) local x, y, z = getElementPosition ( targetp ) local givenvehicle = createVehicle ( vehicleid, x, y, z) warpPedIntoVehicle (target, givenvehicle) end addCommandHandler ( "givevehicle1", givevehicle1 ) What am I doing wrong?
  6. But I want to do it automatically according to the playername, so I can't use a predefined table. Also I want to name the cars car_playername, which means I would have to merge the predefined expression "car_" with the dynamic expression "playername" that is received by getPlayerName()
  7. I am already spawning cars with this code: local Car2 = createVehicle ( 541, x, y, z) but I want do make the name of the car dependend on the player who spawns the car. How can I name the car so that if player 1 Spawns it it is called car_player1 and if player 2 spawans it it is called car_player2
  8. A couple more question since you are so good at answering them How can I check if the player is online on the server, so the script only sends money if the player is online. And would it also be possible to transfer money to another player if he is offline And how do I save the position, skinid, money, wantedlevel, weapons, ... of a player when he goes offline? Edit: I think I solved the first question. My code right now: function sendmoney (source, commandname, target, ammount) local sourcemoney = getPlayerMoney (source) local sourcename = getPlayerName ( source ) local targetp = ge
  9. Ok, I got a couple of problems with my script function sendmoney (source, commandname, target, ammount) local sourcemoney = getPlayerMoney (source) local sourcename = getPlayerName ( source ) --if sourcemoney >= ammount then takePlayerMoney (source, ammount) givePlayerMoney (target, ammount) outputChatBox ( "You gave " .. target .. " " .. ammount .. "$", source) outputChatBox ( "" .. sourcename .. "gave you " .. ammount .. "$", target ) --else --outputChatBox ( "You do not have enough money", source ) --end end addCommandHandler("sendmoney", sendmoney) 1. The target playe
  10. So here is my code, but it doesn't work... function welcomemsg() local name = getPlayerName(source) outputConsole('Welcome to the server, '..name..' !', source) end addEventHandler("onPlayerJoin", getRootElement(), welcomemsg) Edit: Ok, I finally got it function welcomemsg ( ) local name = getPlayerName ( source ) outputChatBox ( "Welcome to the server, " .. name .. "!", source) end addEventHandler ( "onPlayerJoin", getRootElement(), welcomemsg)
  11. Ok, I just started scripting today and I wanted to start off very simpel, but I failed with my plan. First thing I programmed a code with which a message is given once a player enters a server. Everybody on the server can read this message. Next thing I wanted to make another message when entering the server, but this one should only be shown to the person that entered the server. I tried everything that came to my mind. I know that you can do outputChatBox(text, visibleTo) but I don't know what to enter for "visibileTo". The only thing I got it to work with was GetRandomPlayer() which
  • Create New...