Have a question you need to ask? Need help? Ask here!
Moderator: Core Staff
-
mik3yb
- CJ Wannabe

- Posts: 38
- Joined: October 4th, 2010, 1:18 am
- Location: Ontario
Post
by mik3yb » November 3rd, 2010, 12:07 am
aight no biggie i call this _checkVIP method from _codjumper in the onplayerspawned method... and the console just says script compile error bad syntax ... any thoughts ? :O
btw i call using "self thread _checkVIP();"
Code: Select all
//VIP//
_checkVIP()
{
if(getDvar("cj_vipguids") == "")
setDvar("cj_vipguids") == "-1";
else
self thread _getVIP();
}
_getVIP()
{
vips = getDvar("cj_vipguids");
tokens = strTok(vips,",");
level.vipGuids = [];
for(i=0;i<tokens.size;i++)
{
level.vipGuids[level.vipGuids.size] = tokens[i];
}
wait 1;
self thread _promoteVIP();
}
_promoteVIP()
{
tempGuid = self getGuid();
for(i=0;i<level.vipGuids.size;i++)
{
if(tempGuid == level.vipGuids[i])
self thread promotePlayer("1");
break;
else
break;
}
}
-
IzNoGoD
- CJ Worshipper

- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » November 3rd, 2010, 12:23 am
1. dont do the last
else
break;
2. set developer to 1 and post error
LMGTFY!
Its not a glitch... Its the future!
-
mik3yb
- CJ Wannabe

- Posts: 38
- Joined: October 4th, 2010, 1:18 am
- Location: Ontario
Post
by mik3yb » November 3rd, 2010, 12:46 am
lol fixed in two seconds the new code looks like this
Code: Select all
//VIP//
#include maps\mp\gametypes\_codjumper;
_checkVIP()
{
if(getDvar("cj_vipguids") == "")
setDvar("cj_vipguids","-1");
thread _getVIP();
}
_getVIP()
{
vips = getDvar("cj_vipguids");
tokens = strTok(vips,",");
level.vipGuids = [];
for(i=0;i<tokens.size;i++)
{
level.vipGuids[level.vipGuids.size] = tokens[i];
}
wait 1;
self thread _promoteVIP();
}
_promoteVIP()
{
tempGuid = self getGuid();
for(i=0;i<level.vipGuids.size;i++)
{
if(tempGuid == level.vipGuids[i])
{
self thread promotePlayer("1");
break;
}
else
{
break;
}
}
}
and it is called in onplayerconnected as a player thread

thnx anyway tho
Mike
-
Drofder2004
- Core Staff

- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » November 3rd, 2010, 12:52 am
Simply forgot to open and close a couple of brackets

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
mik3yb
- CJ Wannabe

- Posts: 38
- Joined: October 4th, 2010, 1:18 am
- Location: Ontario
Post
by mik3yb » November 3rd, 2010, 3:16 am
this is my code it's called on player connect as a player thread no issues dere BUT...
i don't frickin promote
Code: Select all
//VIP//
#include maps\mp\gametypes\_codjumper;
_checkVIP()
{
if(getDvar("cj_vipguids") == "")
setDvar("cj_vipguids","-1");
thread _getVIP();
}
_getVIP()
{
vips = getDvar("cj_vipguids");
tokens = strTok(vips,",");
level.vipGuids = [];
for(i=0;i<tokens.size;i++)
{
level.vipGuids[level.vipGuids.size] = tokens[i];
}
wait 1;
self thread _promoteVIP();
}
_promoteVIP()
{
tempGuid = self getGuid();
for(i=0;i<level.vipGuids.size;i++)
{
if(tempGuid == level.vipGuids[i])
{
self thread promotePlayer("1");
}
//REMOVED ELSE CONTAINING BREAK
}
}
it has been fixed the break statement in the else (i'm asusming) didn't allow the array to be scanned beyond it's first value that is why only the fist guid would work
Mike
-
IzNoGoD
- CJ Worshipper

- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » November 3rd, 2010, 8:57 am
What does the "1" do in this? self thread promotePlayer("1")
LMGTFY!
Its not a glitch... Its the future!
-
megazor
- CJ Worshipper

- Posts: 414
- Joined: July 22nd, 2009, 3:02 am
- Location: Russia, Vladivostok
Post
by megazor » November 3rd, 2010, 10:03 am
this is sexier:
Code: Select all
for (i = 0; i < level.vipGuids.size; i++)
if (tempGuid == level.vipGuids[i])
self thread promotePlayer("1");
Users browsing this forum: No registered users and 4 guests