class id on public onplayerspawn
#1

it is possible to make the classid in OnPlayerSpawn ?
if it is not possible how can i do for that :
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1551.7479,-1675.5494,15.9859);
    
SetPlayerCameraPos(playerid1548.7133,-1675.3954,14.6442);
    
SetPlayerCameraLookAt(playerid1551.7479,-1675.5494,15.9859);
    
SetPlayerFacingAngle(playerid90);
     if(
classid == 0)
    {
        
ShowPlayerDialog(playeridDIALOG_CLASS_POLICIERDIALOG_STYLE_INPUT"Toutes les classes policiers""Policier\nSwat\nFBI\nBuldozer\nCloacker\n""Selectionner""Fermйe");
        return 
1;
    }
    return 
1;

it is making a dialog when he choose the first AddPlayerClass but me i don't want that
if it is possible how to make that ?
Reply
#2

GetPlayerSkinID ?

Since Classid is the same as SkinID.


You could do something like

new classid = GetPlayerSkinID(playerid);
Reply
#3

and i can do that in public OnPlayerSpawn ?
Reply
#4

You can do that anywhere in the script.

You cannot edit the original OnPlayerSpawn with it without some hooking and such.

Just simply do

PHP код:
public OnPlayerSpawn(playerid) {
    switch(
GetPlayerSkin(playerid)) {
        
//code here
    
}
    return 
1;

Reply
#5

PHP код:
new gTeam[MAX_PLAYERS];
#define TEAM_COP 1
public OnPlayerRequestClass(playeridclassid

    
SetPlayerPos(playerid1551.7479,-1675.5494,15.9859); 
    
SetPlayerCameraPos(playerid1548.7133,-1675.3954,14.6442); 
    
SetPlayerCameraLookAt(playerid1551.7479,-1675.5494,15.9859); 
    
SetPlayerFacingAngle(playerid90); 
     if(
classid == 0
    { 
   
gTeam[playerid] == TEAM_COP;
   
ShowPlayerDialog(playeridDIALOG_CLASS_POLICIERDIALOG_STYLE_INPUT"Toutes les classes policiers""Policier\nSwat\nFBI\nBuldozer\nCloacker\n""Selectionner""Fermйe"); 
        return 
1
    } 
    return 
1
}  
public 
OnPlayerSpawn(playerid)
{
if(
gTeam[playerid == TEAM_COP)
{
  
SetPlayerPos(playerid,x,y,z);
  
SetPlayerFacingAngle(playerid,angle);
}
/* else if(gTeam[playerid] != TEAM_COP)
    {
    SetPlayerPos(playerid,x,y,z);
    SetPlayerFacingAngle(playerid,angle);
    }*/
return 1;

Reply
#6

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1551.7479,-1675.5494,15.9859);
    
SetPlayerCameraPos(playerid1548.7133,-1675.3954,14.6442);
    
SetPlayerCameraLookAt(playerid1551.7479,-1675.5494,15.9859);
    
SetPlayerFacingAngle(playerid90);
    if(
classid == 0)
       {
           
gTeam[playerid] == TEAM_COP// here line 120
           
ShowPlayerDialog(playeridDIALOG_CLASS_POLICIERDIALOG_STYLE_INPUT"Toutes les classes policiers""Policier\nSwat\nFBI\nBuldozer\nCloacker\n""Selectionner""Fermйe");
        return 
1;
    }
    return 
1;

Код:
C:\Users\mickael\Desktop\PAWNO\gamemodes\PayDay2.pwn(120) : warning 215: expression has no effect
i've got to ignore it ?
Reply
#7

Hello! Here is the correct code:

PHP код:
public OnPlayerRequestClass(playeridclassid

    
SetPlayerPos(playerid1551.7479,-1675.5494,15.9859); 
    
SetPlayerCameraPos(playerid1548.7133,-1675.3954,14.6442); 
    
SetPlayerCameraLookAt(playerid1551.7479,-1675.5494,15.9859); 
    
SetPlayerFacingAngle(playerid90); 
    if(
classid == 0
       { 
           
gTeam[playerid] = TEAM_COP// here line 120 
           
ShowPlayerDialog(playeridDIALOG_CLASS_POLICIERDIALOG_STYLE_INPUT"Toutes les classes policiers""Policier\nSwat\nFBI\nBuldozer\nCloacker\n""Selectionner""Fermйe"); 
        return 
1
    } 
    return 
1

Hope it works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)