ForceClass
#1

SOLVED!
Reply
#2

Try this!

PHP код:
CMD:force(playerid,params[]) 

           if(
pData[playerid][pAdmin] < 1) return 0
           new 
idJstring[256]; 
           if(
sscanf(params"u"id)) return SendClientMessage(playeridRED"Usage: /force <Player ID>  will force a player to the class selection!"); 
           if(!
IsPlayerConnected(id) || id == INVALID_PLAYER_ID
           { 
               
SendClientMessage(playeridRED"That Player Is Not Connected."); 
               return 
1
           } 
           
ForceClass[id] = 1;  // 'id' not 'playerid'
           
format(Jstring,sizeof(Jstring),"You have forced '%s' to class selection",GetName(id)); 
           
SendClientMessage(playerid,COLOR_ADMIN,Jstring); 
           
format(Jstring,sizeof(Jstring),"Admin '%s' has forced you to class selection",GetName(playerid)); 
           
SendClientMessage(id,COLOR_ADMIN,Jstring); 
           
SetPlayerHealth(id,0); 
           
ForceClassSelection(id); 
           return 
1

Reply
#3

Try this:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(!ForceClass[playerid] && IsPlayerRegisterd[playerid] == 1) // If player is registerd and forced to class selection by an admin
		SetPlayerSkin(playerid, pData[playerid][pSkin]); // <-- It caused by this code

	SetPlayergTeam(playerid, pData[playerid][pTeam]);
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerColor(playerid, DEATH);
	TogglePlayerSpectating(playerid, 0);
	return 1;
}
You don't need that much if statements.

And also, change
Код:
ForceClass[playerid] = 1;
to
Код:
ForceClass[id] = 1;
as the player that being forced to class selection is "id".

Edit: AjaxM was faster.
Reply
#4

Quote:
Originally Posted by AjaxM
Посмотреть сообщение
Try this!

PHP код:
CMD:force(playerid,params[]) 

           if(
pData[playerid][pAdmin] < 1) return 0
           new 
idJstring[256]; 
           if(
sscanf(params"u"id)) return SendClientMessage(playeridRED"Usage: /force <Player ID>  will force a player to the class selection!"); 
           if(!
IsPlayerConnected(id) || id == INVALID_PLAYER_ID
           { 
               
SendClientMessage(playeridRED"That Player Is Not Connected."); 
               return 
1
           } 
           
ForceClass[id] = 1;  // 'id' not 'playerid'
           
format(Jstring,sizeof(Jstring),"You have forced '%s' to class selection",GetName(id)); 
           
SendClientMessage(playerid,COLOR_ADMIN,Jstring); 
           
format(Jstring,sizeof(Jstring),"Admin '%s' has forced you to class selection",GetName(playerid)); 
           
SendClientMessage(id,COLOR_ADMIN,Jstring); 
           
SetPlayerHealth(id,0); 
           
ForceClassSelection(id); 
           return 
1

Nope
Reply
#5

Quote:
Originally Posted by X337
Посмотреть сообщение
Try this:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(!ForceClass[playerid] && IsPlayerRegisterd[playerid] == 1) // If player is registerd and forced to class selection by an admin
		SetPlayerSkin(playerid, pData[playerid][pSkin]); // <-- It caused by this code

	SetPlayergTeam(playerid, pData[playerid][pTeam]);
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerColor(playerid, DEATH);
	TogglePlayerSpectating(playerid, 0);
	return 1;
}
You don't need that much if statements.

And also, change
Код:
ForceClass[playerid] = 1;
to
Код:
ForceClass[id] = 1;
as the player that being forced to class selection is "id".

Edit: AjaxM was faster.
My code doesn't work this way. I have a system where new players can choose skin but once they login and quit then skin will be saved and it will same skin if they re join. So, i m creating a system like a hospital where they can change skin.
Reply
#6

Quote:
Originally Posted by sscarface
Посмотреть сообщение
My code doesn't work this way. I have a system where new players can choose skin but once they login and quit then skin will be saved and it will same skin if they re join. So, i m creating a system like a hospital where they can change skin.
My code is same as yours, i just make it shorter and make a fix by allowed player to change their skin after being forced to class selection, like you wanted to.
Reply
#7

Quote:
Originally Posted by X337
Посмотреть сообщение
My code is same as yours, i just make it shorter and make a fix by allowed player to change their skin after being forced to class selection, like you wanted to.
Tried and not working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)