I can't compline my GM cause of 1 error
#1

So..This is the code:

Код:
if(strval(GetServerIP()) != "84.238.198.10") return printf("Stupid stealer");
this is the error:

Код:
error 033: array must be indexed (variable "-unknown-")
Reply
#2

pawn Код:
if(strval(GetServerIP()) != "84.238.198.10")
//that's wrong way to compare strings, use strcmp:
if(!strcmp(GetServerIP(), "84.238.198.10", false))
Reply
#3

I might be wrong, but I don't think you can use the not equal to operand to check strings. try using strcmp

pawn Код:
if(strcmp(strval(GetServerIP()),"84.238.198.10",false) == 0)
also you will need to bind the server ip in server.cfg to get the IP with GetServerIP ( once again, I think. not factual )
Reply
#4

The code don't work now..
Reply
#5

There's also the possibility of binding your server to a certain IP by adding "bind" in your server.cfg.

https://sampwiki.blast.hk/wiki/Server.cfg

EDIT: Use the search function next time.
http://forum.sa-mp.com/showthread.ph...ht=getserverip
Reply
#6

I maked my own code.Look at the errors and help me to fix them.

P.S: Don't give me links for other scripts.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)