Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2333 334 335338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
@DannyDeth
I didn't say you can write the value nil...
I just said you can let it look like nil with a string, it's something completely different.
And to the last thing: lol.

@All
I've got a question.
How can I check if a tile between two positions is a wall?
I know that I can calculate how far they are away from each other with math.sqrt:
1
math.sqrt((y-player(id,"y"))^2 + (x-player(id,"x"))^2)
and that I can just turn a x value into a tilex value with math.floor:
1
2
x = 67
math.floor(x/32) -- 2
But how do I check every single tile without writing to much code?
Like this:
1
2
3
4
5
6
if rot1 < rot2 + 20 and rot1 > rot2 - 20 then
	if math.sqrt((y-player(id,"y"))^2 + (x-player(id,"x"))^2) < 300 then
		--check if wall is there
			--code
	end
end

alt Re: Lua Scripts/Questions/Help

vilimonas
User Off Offline

Zitieren
can any of you help me how to use lua scripts plase i want to create a rp server on cs2d so plzzzz






thx a little





but do anybodie have a rp server and can i be a admin plss maby tere you can tell me more and plase i always wanted to be a admin
3× editiert, zuletzt 23.12.10 22:01:34

alt Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Zitieren
@Yasday:
I guess there's no other way, other than what you said. Convert it from pixels to tiles(/32) and use tile(x,y,"wall").
Edit: btw, you dont really need to use math.floor, because it will round itself when you call tile(x,y,"wall") (not sure though) .

@DannyDeth:
to update (and display) hp of a player every 100ms is very inefficient. Just assign this to "hit" hook, because that's the only place where hp really changes. It will be more accurate and a little bit less lag
J.

alt Re: Lua Scripts/Questions/Help

Simplest
User Off Offline

Zitieren
My lua script won't work
This is my first big script so the error might be very big...
Spoiler >

Its very long..

alt Re: Lua Scripts/Questions/Help

Simplest
User Off Offline

Zitieren
alir292 hat geschrieben
can anyone plz tell me how to become ct admin ( and also what do i do with RP ACHIVE plz tell me by PM plzplzplz


in the rp lua file, find the "admin={#####,}"
and replace the 5 numbers with your USGN ID

if your lua file doesnt have that then it might have a separate .TXT file, just replace the existing USGN with your USGN ID

alt geschlossen Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Zitieren
Dantes Inferno hat geschrieben
can someone help me how do i put a picture in the signature box


OFF TOPIC!!!
Use [ img ] link [ /img ]
without the spaces.

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
Zitat
My lua script won't work
This is my first big script so the error might be very big...


Spoiler >


The error shouldnt be big. Everywhere you put too less "end" they are needed for "elseif" and function closing also for every "if" and everywhere there are 2,3 of them while should be ~8 count everything.

------------------------------------------------------

Now My part :

How do i check if player has enough points then...
1
points[id]=points[id]-1

and player get credits well i know that part but i want
to make -points instead of money
1
if (player(id,"money")>14999) --Here has to be points instead of money
1× editiert, zuletzt 24.12.10 11:27:15

alt Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Zitieren
@Batlaizys:
Could you explain a little better what you want to do? It is coming across that you want a point system that gives them credits for each point or something like that...

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
In my Bat Mod i have implemented streaks. If you get 30 streaks you get one mega point. you can exchange it into 200 credits or later buy special powers. I have made shop for money.
it checks if player id miney >14999 then he buys that and loses 15000 but this is money. How to do it for points ? i mean points[id]...

alt Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Zitieren
You can't drop the wrench first place, lol.

@Batlaizys
Ok, so you have a table with each person's points, correct? So you want to know how to remove the credits when they spend in a shop? I will give you an example:
1
2
3
4
function trade(player_id, item_id)
	price = item_price[item_id]
	credits[player_id] = credits[player_id] - price
end
This function will remove the credits from the dude's "bank account" according to the price of the item in item_price[] table.

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
no no no. We talk about Buying credits for MEGA POINTS i want to know how to check if player has more than 0 mega points. but dont know how cause points have id like if player points[id] > 0 ,then
credits[id]=credits[id]+200. Somthing like that, i dont know if this is right...

alt Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Zitieren
Okay! I get it now! So you want to check if the player has Megapoints, and then exchange them for credits, you would have to have 2 tables: one called credits[] and one called mpoints[]. So this is what you do, in a function:
1
2
3
4
5
6
7
function exchange_mpoints_for_credits(id)
	if (mpoints[id] > 0) then
		credits[id] = credits[id] + ( mpoints[id] * 200 )
	else
		msg(copyright.."2550000You have no MegaPoints to exchange for credits!")
	end
end

alt Re: Lua Scripts/Questions/Help

brk951753
User Off Offline

Zitieren
i need help
i dont know how to make save system :S
i will save licences

pls use minute function

if rp_hplicence[id]== true or rp_hitlicence[id]== true or rp_buldlicence[id]== true or rp_license[id]==true or yourmon[id] >= 1 then


save =>>rp_hplicence[id]
save =>>rp_hitlicence[id]
save =>>rp_buldlicence[id]
save =>>yourmon[id]
save =>>rp_license[id]


pls help me...
Zum Anfang Vorherige 1 2333 334 335338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht