SA-MP Forums Archive
Help with class messages. - 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: Help with class messages. (/showthread.php?tid=196837)



Help with class messages. - Rokzlive - 07.12.2010

I want it so that when a player spawns a certain class, it send them a message based on that class. I tried this.


pawn Код:
public OnPlayerSpawn(playerid, classid)
{
    AntiDeAMX();
    SetPlayerInterior(playerid,0);
    TogglePlayerClock(playerid,0);
    if(classid == 1)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    else if (classid == 2)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    else if(classid == 3)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    else if (classid == 4)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    else if(classid == 5)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    else if (classid == 6)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    else if(classid == 7)
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Make sure everyone obeys all traffic laws!");
    else if (classid == 8)
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Make sure everyone obeys all traffic laws!");
    else if(classid == 9)
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Make sure everyone obeys all traffic laws!");
    else if (classid == 10)
    SendClientMessage(playerid,COLOR_RED,"Help people who are in /distress!");
    else if(classid == 11)
    SendClientMessage(playerid,COLOR_RED,"Help people who are in /distress!");
    else if (classid == 12)
    SendClientMessage(playerid,COLOR_RED,"Help people who are in /distress!");
    else if(classid == 13)
    SendClientMessage(playerid,COLOR_GREEN,"Dispatch trucks and keep everyone om schedule!");
    else if (classid == 14)
    SendClientMessage(playerid,COLOR_GREEN,"Dispatch trucks and keep everyone om schedule!");
    else if(classid == 15)
    SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
    return 1;
}
It errors like this.

C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(523) : error 025: function heading differs from prototype

It says the errors on line 523 and puclic OnPlayerSpawn(playerid,classid) is line 523. Plz help!


Re: Help with class messages. - TheXIII - 07.12.2010

OnPlayerSpawn doesn't have a classid parameter. You need to retrive it in some other way.


Re: Help with class messages. - fangoth1 - 07.12.2010

define the class under the spawn not in it use this

pawn Код:
public OnPlayerSpawn(playerid)



Re: Help with class messages. - Rokzlive - 07.12.2010

Then how would i do this?


Re: Help with class messages. - fangoth1 - 07.12.2010

this how you would do it
pawn Код:
public OnPlayerSpawn(playerid)
{
   new classid = GetPlayerClass(playerid);
   AntiDeAMX();  
   SetPlayerInterior(playerid,0);    
   TogglePlayerClock(playerid,0);
   
   if(classid == 1)    
  {
  SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
  }
   
  else if (classid == 2)
  {  
  SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
  }  
  else if(classid == 3)    
  {
   SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
   }
   else if (classid == 4)  
   {
   SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
   }
   else if(classid == 5)    
   {
   SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");    
   }
   else if (classid == 6)    
   {
   SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");    
   }
   else if(classid == 7)    
   {
   SendClientMessage(playerid,COLOR_LIGHTBLUE,"Make sure everyone obeys all traffic laws!");  
   }
   else if (classid == 8)    
   {
   SendClientMessage(playerid,COLOR_LIGHTBLUE,"Make sure everyone obeys all traffic laws!");    
   }
   else if(classid == 9)    
   {
   SendClientMessage(playerid,COLOR_LIGHTBLUE,"Make sure everyone obeys all traffic laws!");    
   }
   else if (classid == 10)    
   {
   SendClientMessage(playerid,COLOR_RED,"Help people who are in /distress!");    
   }
   else if(classid == 11)    
   {
   SendClientMessage(playerid,COLOR_RED,"Help people who are in /distress!");    
   }
   else if (classid == 12)    
   {
   SendClientMessage(playerid,COLOR_RED,"Help people who are in /distress!");    
   }
   else if(classid == 13)    
   {
   SendClientMessage(playerid,COLOR_GREEN,"Dispatch trucks and keep everyone om schedule!");    
   }
   else if (classid == 14)    
   {
   SendClientMessage(playerid,COLOR_GREEN,"Dispatch trucks and keep everyone om schedule!");    
   }
   else if(classid == 15)    
   {
   SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");    
   }
   return 1;
}



Re: Help with class messages. - XePloiT - 07.12.2010

maybe try this...
pawn Код:
public OnPlayerSpawn(playerid)
{
     new cid=GetPlayerSkin(playerid); // fixed
     if(cid == 1) SendClientMessage(playerid,COLOR_YELLOW,"Type /work to being a mission!");
     // etc..... you got the idea
     return 1;
}



Re: Help with class messages. - Rokzlive - 07.12.2010

tytytytytytyty


Re: Help with class messages. - willsuckformoney - 07.12.2010

or GetPlayerSkin...


Re: Help with class messages. - Rokzlive - 07.12.2010

Now this error.

C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(524) : error 017: undefined symbol "GetPlayerClass"


Re: Help with class messages. - XePloiT - 07.12.2010

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
or GetPlayerSkin...
he is right... my bad...
change new cid=GetPlayerClass(playerid);
to new cid=GetPlayerSkin(playerid);