Problem with Spawnpoints -
samtey - 02.08.2011
Hello everybody!
Well, I was working on a system, where the player can't betray his gang! He can only choose one gang/skin, and will play with this skin forever!!!
Now these are my AddPlayerClasses, b
ut every player has his own spawnpoint!
pawn Код:
public OnGameModeInit() {
SetNight();
SetGameModeText("***Live your own life as a GangstA***");
//Ballas
AddPlayerClass(102, 1974.4895,-1157.0608,20.9505,95.6222, 30, 350, 29, 350, 27, 350); //Ballas1
AddPlayerClass(103, 1976.7120,-1183.5504,26.0188,98.0542, 22, 350, 34, 350, 29, 350); //Ballas2
AddPlayerClass(104, 2092.0271,-1166.3419,26.5859,89.4869, 28, 350, 23, 350, 4, 0); //Ballas3
//Grove
AddPlayerClass(269, 2486.7598,-1647.5186,14.0703,187.5500, 30, 350, 25, 350, 24, 350); //Smoke
AddPlayerClass(271, 2459.9001,-1688.4135,13.5280,2.9949, 33, 350, 32, 350, 31, 350); //Ryder
AddPlayerClass(270,2516.3430,-1674.3085,13.9348,81.6422,32,350,31,350,34,350); // Sweet
AddPlayerClass(0,2495.4890,-1688.2717,13.7022,5.9233,1,0,29,350,27,350); // CJ
AddPlayerClass(105,2451.6484,-1642.4531,13.7357,182.6713,28,350,33,350,22,350); // grove1
AddPlayerClass(106,2413.7170,-1647.2096,14.0119,174.8622,26,350,30,350,23,350); // grove2
AddPlayerClass(107,2408.6982,-1674.0126,13.6037,356.5973,34,350,30,350,32,350); // grove3
//Vagos
AddPlayerClass(108,2571.8352,-1091.2091,66.9639,48.7203,29,350,9,0,31,350); // Vagos1
AddPlayerClass(109,2569.7373,-1088.5804,67.0079,220.8869,22,350,33,350,30,350); // Vagos2
AddPlayerClass(110,2576.0371,-1070.5568,69.8322,89.5007,27,350,24,350,32,350); // Vagos3
return 1;
}
And now, for my theory with antibetray, here my code!
pawn Код:
SetPlayerSpawn(playerid) {
new p_skin = gPlayerSkinForEver[playerid];
if(p_skin == 102 || p_skin == 103 || p_skin == 104) { // This is BALLAS.
SetSpawnInfo(playerid, 1, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0); // You need to change these values.
} else if(p_skin == 267 || p_skin == 271 || p_skin == 270 || p_skin == 0 || p_skin == 105 || p_skin == 106 || p_skin == 107) { // This is GROOVE.
SetSpawnInfo(playerid, 2, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0); // You need to change these values.
} else if(p_skin == 108 || p_skin == 109 || p_skin == 110) { // This is VAGOS.
SetSpawnInfo(playerid, 3, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0); // You need to change these values.
}
SpawnPlayer(playerid);
return 1;
}
He wants again co-ordinates!
Can I do it somehow else
I want that the old spawnpoints from AddPlayerClasses stay!!!
Oh, something else: Me as admin can change his skin whenever he wants!
Re: Problem with Spawnpoints -
Godhimself - 02.08.2011
Save there rank to a file...then...
pawn Код:
public OnPlayerSpawn(playerid)
{
if(isteam1rank(playerid))
{
//spawn them with the skin/features..
}
else if(isteam2rank(playerid))
{
//spawn them with the skin/features..
}
//etc etc..
}
Re: Problem with Spawnpoints -
sansko - 02.08.2011
this is the third topic you create about this, please start learning the basics and think of ways to do this. i will give you a start but no code.
what if you use the "switch" function to go trough all the skins and set their spawns and give the admins a simple /skin cmd or if you want a /setmyspawninfo cmd.
use sscanf to make the cmds simple
AW: Problem with Spawnpoints -
samtey - 02.08.2011
@Godhimself
Hmm, I dunno if this is right, I made it like this:
pawn Код:
if(INI_Open(getINI(playerid))) {
INI_WriteInt("Cash", GetPlayerMoney(playerid));
INI_WriteInt("Admin", PlayerInfo[playerid][pAdmin]);
INI_WriteInt("FirstTime", gFirstTimeHasJoined[playerid]);
INI_WriteInt("Forever", gPlayerSkinForEver[playerid]);
INI_WriteInt("Skin", GetPlayerSkin(playerid));
INI_Save();
INI_Close();
And then:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gFirstTimeHasJoined[playerid])
{
return OnPlayerRequestClass;
SendClientMessage,(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
}
else if(gPlayerSkinForEver(playerid))
{
GetPlayerSkin(playerid);
SendClientMessage,(playerid,COLOR_RED,"You are already in a gang!");
}
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0);
SetPlayerToTeamColor(playerid);
return 1;
}
But 6 errors:
Код:
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(338) : error 076: syntax error in the expression, or invalid function call
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(339) : error 076: syntax error in the expression, or invalid function call
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(339) : warning 215: expression has no effect
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(341) : error 012: invalid function call, not a valid address
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(341) : warning 215: expression has no effect
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(341) : error 001: expected token: ";", but found ")"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(341) : error 029: invalid expression, assumed zero
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(341) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
338:
pawn Код:
return OnPlayerRequestClass;
339:
pawn Код:
SendClientMessage,(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
And 341:
pawn Код:
else if(gPlayerSkinForEver(playerid))
Re: Problem with Spawnpoints -
Gray - 02.08.2011
Код:
SendClientMessage(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
Line 339
Код:
else if(gPlayerSkinForEver[playerid])
Line 341
Код:
return OnPlayerRequestClass(playerid, classid);
Perhaps?
Line 338
AW: Problem with Spawnpoints -
samtey - 02.08.2011
Код:
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(338) : error 017: undefined symbol "classid"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(339) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
pawn Код:
return OnPlayerRequestClass(playerid, classid);
SendClientMessage(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
What do u mean with perhaps?
Re: Problem with Spawnpoints -
iPLEOMAX - 02.08.2011
pawn Код:
if(gFirstTimeHasJoined[playerid])
{
ForceClassSelection(playerid);
SpawnPlayer(playerid);
SendClientMessage,(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
return true;
}
//classid = not defined in OnPlayerSpawn.
AW: Problem with Spawnpoints -
samtey - 02.08.2011
Ok, thanks!
And when I want that admins can change his/her skins, it's like this, right?
pawn Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
ForceClassSelection(playerid);
SendClientMessageToAll(COLOR_RED,"Welcome back, Master!");
return true;
}
else if(gFirstTimeHasJoined[playerid])
{
ForceClassSelection(playerid);
SpawnPlayer(playerid);
SendClientMessage(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
return true;
}
else if(gPlayerSkinForEver[playerid])
{
GetPlayerSkin(playerid);
SendClientMessage(playerid,COLOR_RED,"You are already in a gang!");
}
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0);
SetPlayerToTeamColor(playerid);
return 1;
}
AW: Problem with Spawnpoints -
samtey - 02.08.2011
It doesn't work, normal players with no admin level, I tested, can still choose another gang!
One time my whole OnPlayerRequestClass:
Код:
public OnPlayerRequestClass(playerid, classid) {
PlayerPlaySound(playerid, 1183, 0.0, 0.0, 0.0);
switch(classid) {
case 0..2: {
SetPlayerTeamFromClass(playerid, classid);
SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
SetPlayerFacingAngle( playerid, 187.0574 );
SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
} case 3..9: {
SetPlayerPos(playerid, 2486.7598,-1647.5186,14.0703);
SetPlayerFacingAngle( playerid, 187.5500 );
SetPlayerCameraPos(playerid, 2486.4346,-1646.0953-5,14.0703);
SetPlayerCameraLookAt(playerid, 2486.7598,-1647.5186,14.0703);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
} case 10..12: {
SetPlayerPos(playerid, 2571.8352,-1091.2091,66.9639);
SetPlayerFacingAngle(playerid, 48.7203 );
SetPlayerCameraPos(playerid, 2570.1152,-1089.5372,66.8601);
SetPlayerCameraLookAt(playerid, 2571.8352,-1091.2091,66.9639);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
}
}
return 1;
}
Should I do something like return OnPlayerSpawn?
One more time my whole code:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
ForceClassSelection(playerid);
SendClientMessageToAll(COLOR_RED,"Welcome back, Master!");
return true;
}
else if(gFirstTimeHasJoined[playerid])
{
ForceClassSelection(playerid);
SpawnPlayer(playerid);
SendClientMessage(playerid,COLOR_RED,"Choose your skin carefully! You can't change it anymore after this!");
return true;
}
else if(gPlayerSkinForEver[playerid])
{
GetPlayerSkin(playerid);
SendClientMessage(playerid,COLOR_RED,"You are already in a gang!");
}
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0);
SetPlayerToTeamColor(playerid);
return 1;
}
Re: Problem with Spawnpoints -
Toreno - 02.08.2011
You messed up completely all what I gave you, read few tutorials before thinking to create such a thing.
You would have understand easily how to fix that, if you had a basic knowledge but you don't, people won't understand the SetPlayerSpawn unless they see your entire mode and rescripting it.
AW: Problem with Spawnpoints -
samtey - 02.08.2011
Because it didn't work and all my spawnpoints with weapons would be f***** up!
Re: Problem with Spawnpoints -
Toreno - 02.08.2011
I explained you what SetSpawnInfo does and even gave you a wiki information, that shows you don't have a basic knowledge and you can't even read wiki information which explains you clearly what it does.
SetSpawnInfo, sets your TEAM, SKIN, COORDINATES, GUN1 + AMMO1, GUN2 + AMMO2, GUN3 + AMMO3.
You could have read the link I gave you in your older topic.
AW: Problem with Spawnpoints -
samtey - 02.08.2011
But I already defined co-ordinates in OnGameModeInit!
I thought they will be deleted! Isn't it like this?
AW: Problem with Spawnpoints -
samtey - 02.08.2011
Eliran Pesahov, if you would know what to do, you would answer my pm! You dunno urself how to fix these errors!
I did it with your method, now look here:
Код:
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(592) : error 017: undefined symbol "x"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(594) : error 017: undefined symbol "x"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(596) : error 017: undefined symbol "x"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
here the lines!
pawn Код:
SetSpawnInfo(playerid, 1, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0); // You need to change these values.
} else if(p_skin == 267 || p_skin == 271 || p_skin == 270 || p_skin == 0 || p_skin == 105 || p_skin == 106 || p_skin == 107) { // This is GROOVE.
SetSpawnInfo(playerid, 2, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0); // You need to change these values.
} else if(p_skin == 108 || p_skin == 109 || p_skin == 110) { // This is VAGOS.
SetSpawnInfo(playerid, 3, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0); // You need to change these values.
AW: Problem with Spawnpoints -
samtey - 02.08.2011
Guys, I'm getting crazy! I can't continue working on my server because I have this problem, plz help me!
AW: Problem with Spawnpoints -
samtey - 02.08.2011
Bump.