SA-MP Forums Archive
Map Voting But the PlayerClass dont work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Map Voting But the PlayerClass dont work? (/showthread.php?tid=290016)



Map Voting But the PlayerClass dont work? - NeverKnow - 13.10.2011

Hey, I've a Problem that i cant Fix =/
I Hope you can help me =)

Ok so my problem is that i made a Vote Map, Everything works but when im at the other map then my Playerclass spawns at the old Position where i were from the last map..=/

Here is some Code:
Quote:

//OnGameModeInit

if(LS == 1)
{
/////////////////////////PlayerSkins//////////////////////////////
AddPlayerClass(288,1604.7856,-1715.3781,6.2188,31.2719,0,0,0,0,0,0); // 288
AddPlayerClass(284,1586.6842,-1685.0203,6.2252,357.5471,0,0,0,0,0,0); // 284
AddPlayerClass(280,1577.0725,-1620.5787,13.5469,89.6914,0,0,0,0,0,0); // 280
AddPlayerClass(282,1565.0551,-1692.9109,5.8906,182.7523,0,0,0,0,0,0); // 282
AddPlayerClass(283,1552.3845,-1709.4213,6.2188,6.9940,0,0,0,0,0,0); // 283
AddPlayerClass(281,1529.7949,-1669.6833,6.2188,297.4568,0,0,0,0,0,0); // 281
AddPlayerClass(286,626.1846,-586.2490,16.7501,268.0517,0,0,0,0,0,0); // 286
AddPlayerClass(176,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 176
AddPlayerClass(19,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 19
AddPlayerClass(103,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 103
AddPlayerClass(173,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 173
AddPlayerClass(28,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 28
AddPlayerClass(47,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 47
AddPlayerClass(192,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 192
AddPlayerClass(21,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 21
AddPlayerClass(294,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 294
AddPlayerClass(293,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 293
AddPlayerClass(104,2216.9397,-1171.2290,25.7266,359.5073,0,0,0,0,0,0); // 104
//and more bla bla bla Scripts :P
}

if(LV == 1)
{
////////////playerskins//////////
AddPlayerClass(288,2292.0620,2460.0078,-7.1953,271.9504,0,0,0,0,0,0); // skin 288
AddPlayerClass(284,2293.5938,2467.8484,10.8203,84. 7303,0,0,0,0,0,0); // skin 284
AddPlayerClass(280,2265.3274,2456.8909,10.8203,86. 7148,0,0,0,0,0,0); // skin 280
AddPlayerClass(282,2268.4221,2446.9397,3.5313,181. 9213,0,0,0,0,0,0); // skin 282
AddPlayerClass(283,2256.3970,2460.8550,-7.1953,87.6362,0,0,0,0,0,0); // skin 283
AddPlayerClass(284,2293.5938,2467.8484,10.8203,84. 7303,0,0,0,0,0,0); // skin 284
AddPlayerClass(286,2281.9067,2425.2625,-7.2444,1.9096,0,0,0,0,0,0); // skin 286
AddPlayerClass(176,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 176
AddPlayerClass(19,1668.4723,1012.8586,10.8203,1.67 68,0,0,0,0,0,0); // 19
AddPlayerClass(103,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 103
AddPlayerClass(173,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 173
AddPlayerClass(28,1668.4723,1012.8586,10.8203,1.67 68,0,0,0,0,0,0); // 28
AddPlayerClass(47,1668.4723,1012.8586,10.8203,1.67 68,0,0,0,0,0,0); // 47
AddPlayerClass(192,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 192
AddPlayerClass(21,1668.4723,1012.8586,10.8203,1.67 68,0,0,0,0,0,0); // 21
AddPlayerClass(294,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 294
AddPlayerClass(293,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 293
AddPlayerClass(104,1668.4723,1012.8586,10.8203,1.6 768,0,0,0,0,0,0); // 104
//And more bla bla.. :P
}

Quote:

I Also tried this:

//OnGameModeInit
CopsLS288 = AddPlayerClass(288,1604.7856,-1715.3781,6.2188,31.2719,0,0,0,0,0,0); // 288
CopsLS284 = AddPlayerClass(284,1586.6842,-1685.0203,6.2252,357.5471,0,0,0,0,0,0); // 284
CopsLS280 = AddPlayerClass(280,1577.0725,-1620.5787,13.5469,89.6914,0,0,0,0,0,0); // 280
CopsLS282 = AddPlayerClass(282,1565.0551,-1692.9109,5.8906,182.7523,0,0,0,0,0,0); // 282
CopsLS283 = AddPlayerClass(283,1552.3845,-1709.4213,6.2188,6.9940,0,0,0,0,0,0); // 283
CopsLS281 = AddPlayerClass(281,1529.7949,-1669.6833,6.2188,297.4568,0,0,0,0,0,0); // 281
CopsLS286 = AddPlayerClass(286,626.1846,-586.2490,16.7501,268.0517,0,0,0,0,0,0); // 286

//onplayerspawn
if(LS == 1)
{
if(gTeam[playerid] == TEAM_Cop)
{
if(CopsLS288 == 1)
{
SetPlayerPos(playerid,1604.7856,-1715.3781,6.218;
}
if(CopsLS284)
{
SetPlayerPos(playerid,1586.6842,-1685.0203,6.2252);
}

if(CopsLS283)
{
SetPlayerPos(playerid,1552.3845,-1709.4213,6.218;
}

if(CopsLS282)
{
SetPlayerPos(playerid,1565.0551,-1692.9109,5.8906);
}

if(CopsLS280)
{
SetPlayerPos(playerid,1577.0725,-1620.5787,13.5469);
}

if(CopsLS281)
{
SetPlayerPos(playerid,1529.7949,-1669.6833,6.218;
}

if(CopsLS286)
{
SetPlayerPos(playerid,626.1846,-586.2490,16.7501);
}
}
}

// But this didn't work too =/, So can someone please help me?

Hope someone can help me out,
Thanks


Re: Map Voting But the PlayerClass dont work? - SVRP - 13.10.2011

Where do you define LS and LV?
Show the code that puts LS or LV on 1.

It's probably that.
You should load the location variable first thing in GameModeInit.
Load it from a file and set LS or LV to 1.
When you've done that, it should be working. The top code at least.
The second code won't.
You store the class ID in a variable, and then you check if the variable is true or not.


Re: Map Voting But the PlayerClass dont work? - NeverKnow - 13.10.2011

ehh?

i have this:

new LV;
new LS;

then when they vote:

if they voted for LS

LV = 0;
LS = 1;

if they voted for LV

Lv=1;
LS=0;

but actually everything work and the whole scripts is Huge but the porblem is that the Playerclasses dont spawn on the map where they need to spawn.. thats just the problem.

but if i go to OnPlayerSpawn and put this:

if(LS == 1)
{
if(Team bla bla == Team_cop)
{
SetPos(playerid,X,Y,Z);
}
}

if(LV == 1)
{
if(Team bla bla == Team_cop)
{
SetPos(playerid,X,Y,Z);
}
}

then the pos work but that does only 1 position...and i want more positions.


Re: Map Voting But the PlayerClass dont work? - SVRP - 13.10.2011

pawn Код:
if(Team PLayer = Team Cop)
{
    if(Get Player Class/Skin == skin 1337)
    {
        SetPlayerPos(playerid, X,Y,Z);
     }
}
Use it like this.
Keep the CopLS*** variables.
But instead of if(CopLS25 you need to get the player skin.
if(GetPlayerSkin(playerid) == CopLS25

That way you only have 1 position that fits the description, instead of all.
If they all match you get the last defined position.
If none of them match, you spawn at the location of the class.

If you have the same position defined in the classes you can leave all this extra code away.
Just place the coordinates in the classes, and spawn after picking one.
You will automatically spawn at the class position.
But if you use those positions for class selection or something, you need to use a different if.


Re: Map Voting But the PlayerClass dont work? - NeverKnow - 14.10.2011

Quote:
Originally Posted by SVRP
Посмотреть сообщение
Use it like this.
Keep the CopLS*** variables.
But instead of if(CopLS25 you need to get the player skin.
if(GetPlayerSkin(playerid) == CopLS25

That way you only have 1 position that fits the description, instead of all.
If they all match you get the last defined position.
If none of them match, you spawn at the location of the class.

If you have the same position defined in the classes you can leave all this extra code away.
Just place the coordinates in the classes, and spawn after picking one.
You will automatically spawn at the class position.
But if you use those positions for class selection or something, you need to use a different if.
Dude TYVM So much, i will test this when im home Thanks for Helping


Re: Map Voting But the PlayerClass dont work? - NeverKnow - 14.10.2011

Quote:
Originally Posted by SVRP
Посмотреть сообщение
pawn Код:
if(Team PLayer = Team Cop)
{
    if(Get Player Class/Skin == skin 1337)
    {
        SetPlayerPos(playerid, X,Y,Z);
     }
}
Use it like this.
Keep the CopLS*** variables.
But instead of if(CopLS25 you need to get the player skin.
if(GetPlayerSkin(playerid) == CopLS25

That way you only have 1 position that fits the description, instead of all.
If they all match you get the last defined position.
If none of them match, you spawn at the location of the class.

If you have the same position defined in the classes you can leave all this extra code away.
Just place the coordinates in the classes, and spawn after picking one.
You will automatically spawn at the class position.
But if you use those positions for class selection or something, you need to use a different if.
it actually didnt work with: if(GetPlayerSkin(playerid) == CopLS28 --> nothing happend (its ignoring it)
so i did: if(GetPlayerSkin(playerid) == 28 --> removed all varriables (just keeped : AddPlayerClass(bla bla)) then it worked

Thank You Very much for your help , Everyting works fine now