SA-MP Forums Archive
AddPlayerClass by Name HELP - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AddPlayerClass by Name HELP (/showthread.php?tid=140860)



AddPlayerClass by Name HELP - cgty94 - 10.04.2010

Код:
public OnGameModeInit()
{
	SetGameModeText("Zombies");
  	UsePlayerPedAnims();

	AddPlayerClass(287,291.6556,2035.5938,17.6406,235.3867,24,100,27,200,31,500);	// Armybase Soldier 0
	AddPlayerClass(70,-1929.2389,640.1990,46.5625,14.7999,0,0,0,0,0,0); 			// Zombo Professor 1
	AddPlayerClass(285,-1929.1486,730.7249,45.2969,211.4319,24,100,27,200,31,500); 	// Zombo 2     2
	AddPlayerClass(111,2190.8342,1676.8771,11.7806,211.4319,24,100,27,200,31,500);	// Cagatay     3
	AddPlayerClass(100,-79.5447,1385.6934,16.9389,211.4319,24,100,27,200,31,500);  // deifnace     4

	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1960.9000, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, MAX_PLAYER_NAME);

	if( (classid == 3) && (!strcmp(name, "[HLF]Cagatay")) ) return 1;
	else SendClientMessage(playerid, COLOR_RED, "This class is locked");

	if( (classid == 4) && (!strcmp(name, "[HLF]Defiance")) ) return 1;
	else SendClientMessage(playerid, COLOR_RED, "This class is locked");

	return 1;
}
er idk whats wrong here but its not working good, even if i join with Name [HLF]Cagatay it says this class is locked for all skins, but it must only be locked for other people with different nicks, and they shouldnt be able to spawn as classid 3 and 4, how to make it working?? HELP



sorry for my bad english


Re: AddPlayerClass by Name HELP - Gamer_Z - 10.04.2010

new playerid;
lol don't put things for individual players in ongamemodeinit, this never won't work... NEVER EVER!
try it in OnPlayerRequestClass


Re: AddPlayerClass by Name HELP - cgty94 - 10.04.2010

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1960.9000, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(strcmp(name, "[HLF]Cagatay") == 0)
{
AddPlayerClass(111,2190.8342,1676.8771,11.7806,211 .4319,24,100,27,200,31,500);
}
if(strcmp(name, "[HLF]Defiance") == 0)
{
AddPlayerClass(100,-79.5447,1385.6934,16.9389,211.4319,24,100,27,200,3 1,500);
}
return 1;
}



i maked like that now i cant see the skin on selection