SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 12/03/2011, 01:52 PM   #1
Compton
Big Clucker
 
Compton's Avatar
 
Join Date: Apr 2009
Posts: 165
Reputation: 6
Default Help With class selection

Hello guys, im a starting scriptor and im still learning using pawno. Im also tryng to create an easy RP server. Well meanwhile I didnt do much and I got stuck on making the Class Selection script. Meanwhile I made an Easy Skin Selection for Grove Street Families, their background is G Street, but when I wanted to create a spawn for ballas for example near Crack Den, I cant figure out how to script it in pawno, well my question is: How to make skin selection that will spawn different skins in different positions.
Compton is offline  
Old 12/03/2011, 01:54 PM   #2
Stigg
High-roller
 
Stigg's Avatar
 
Join Date: Aug 2010
Location: Other side of the Universe.
Posts: 2,085
Reputation: 111
Default Re: Help With class selection

Try here:

http://wiki.sa-mp.com/wiki/AddPlayerClass
http://wiki.sa-mp.com/wiki/OnPlayerRequestClass
http://wiki.sa-mp.com/wiki/Random
__________________

Peace...

Stigg is offline  
Old 12/03/2011, 02:00 PM   #3
Compton
Big Clucker
 
Compton's Avatar
 
Join Date: Apr 2009
Posts: 165
Reputation: 6
Default Re: Help With class selection

Well that didnt help me much, but here ill try to make it easier for you guys to take a look on what I made and what should I fix here so it will work, maybe there is supposed to be some operator between them I dont know..


Code:
   	public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 2527.9763,-1666.6794,15.1682);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 2522.4639,-1667.2499,15.0358);
	SetPlayerCameraLookAt(playerid, 2527.9763,-1666.6794,15.1682);
	GameTextForPlayer(playerid, "~g~Grove Street Families", 500, 3);
	return 1;
}

{
	SetPlayerPos(playerid, 320.1396,1122.7827,1083.8828);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 320.2842,1118.7600,1083.8828);
	SetPlayerCameraLookAt(playerid, 320.1396,1122.7827,1083.8828);
	GameTextForPlayer(playerid, "~b~Front Yard Ballas", 500, 3);
	return 1;
}
Compton is offline  
Old 12/03/2011, 02:02 PM   #4
Stigg
High-roller
 
Stigg's Avatar
 
Join Date: Aug 2010
Location: Other side of the Universe.
Posts: 2,085
Reputation: 111
Default Re: Help With class selection

Quote:
Originally Posted by Compton View Post
Well that didnt help me much, but here ill try to make it easier for you guys to take a look on what I made and what should I fix here so it will work, maybe there is supposed to be some operator between them I dont know..


Code:
   	public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 2527.9763,-1666.6794,15.1682);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 2522.4639,-1667.2499,15.0358);
	SetPlayerCameraLookAt(playerid, 2527.9763,-1666.6794,15.1682);
	GameTextForPlayer(playerid, "~g~Grove Street Families", 500, 3);
	return 1;
}

{
	SetPlayerPos(playerid, 320.1396,1122.7827,1083.8828);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 320.2842,1118.7600,1083.8828);
	SetPlayerCameraLookAt(playerid, 320.1396,1122.7827,1083.8828);
	GameTextForPlayer(playerid, "~b~Front Yard Ballas", 500, 3);
	return 1;
}
You obviously did'nt read the info in the links i provided.
__________________

Peace...

Stigg is offline  
Old 12/03/2011, 02:35 PM   #5
Compton
Big Clucker
 
Compton's Avatar
 
Join Date: Apr 2009
Posts: 165
Reputation: 6
Default Re: Help With class selection

Ok, I just took a look in those tutorials but nothing helped me there, seriously I did read them now.. but there is nothing that looks like my codes, but the point is, if I delete the second code the first script will work. So can you simply explain me whats my mistake here?
Compton is offline  
Old 12/03/2011, 02:40 PM   #6
Stigg
High-roller
 
Stigg's Avatar
 
Join Date: Aug 2010
Location: Other side of the Universe.
Posts: 2,085
Reputation: 111
Default Re: Help With class selection

pawn Code:
if(classid == w/e)//skinid
    {
        //do your stuff
        return 1;
    }
else if(classid == w/e)//skinid
    {
       //do your stuff
        return 1;
    }

And so on. Something like that. Or use a switch like in the post below this.
__________________

Peace...

Stigg is offline  
Old 12/03/2011, 03:06 PM   #7
alpha500delta
High-roller
 
alpha500delta's Avatar
 
Join Date: Feb 2010
Posts: 1,301
Reputation: 91
Default Re: Help With class selection

You should use a switch statement for that.
pawn Code:
switch(classid)
{
    case 0:
    {
         //do your stuff
    {
    case 1:
    {
         //do your stuff
    }
    return 1;
}
__________________
Skype: Alpha500delta | Steam: Alpha500delta
alpha500delta is offline  
Old 12/03/2011, 03:38 PM   #8
Compton
Big Clucker
 
Compton's Avatar
 
Join Date: Apr 2009
Posts: 165
Reputation: 6
Default Re: Help With class selection

like this??

Code:
public OnPlayerRequestClass(playerid, classid)

	switch(classid)
{
	case 0:
	{
	SetPlayerPos(playerid, 2527.9763,-1666.6794,15.1682);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 2522.4639,-1667.2499,15.0358);
	SetPlayerCameraLookAt(playerid, 2527.9763,-1666.6794,15.1682);
	GameTextForPlayer(playerid, "~g~Grove Street Families", 500, 3);
	{
	case 1:
	{
	SetPlayerPos(playerid, 320.1396,1122.7827,1083.8828);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 320.2842,1118.7600,1083.8828);
	SetPlayerCameraLookAt(playerid, 320.1396,1122.7827,1083.8828);
	GameTextForPlayer(playerid, "~b~Front Yard Ballas", 500, 3);
	}
	return 1;
}
Well it showed a error to me(sorry guys but im a total n00b in this meanwhile xD
Compton is offline  
Old 12/03/2011, 03:44 PM   #9
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,871
Reputation: 1203
Default Re: Help With class selection

I know why. You should open the callback with a bracket

pawn Code:
public OnPlayerRequestClass(playerid, classid)
//Over here!
    switch(classid)
{
so ehm this is the new code (And please use [ pawn ] BBcode

pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
{
    case 0:
    {
    SetPlayerPos(playerid, 2527.9763,-1666.6794,15.1682);
    SetPlayerFacingAngle(playerid,100.0);
    SetPlayerCameraPos(playerid, 2522.4639,-1667.2499,15.0358);
    SetPlayerCameraLookAt(playerid, 2527.9763,-1666.6794,15.1682);
    GameTextForPlayer(playerid, "~g~Grove Street Families", 500, 3);
    {
    case 1:
    {
    SetPlayerPos(playerid, 320.1396,1122.7827,1083.8828);
    SetPlayerFacingAngle(playerid,100.0);
    SetPlayerCameraPos(playerid, 320.2842,1118.7600,1083.8828);
    SetPlayerCameraLookAt(playerid, 320.1396,1122.7827,1083.8828);
    GameTextForPlayer(playerid, "~b~Front Yard Ballas", 500, 3);
    }
    return 1;
}

I can't help you futher though. I gtg
__________________
Lalalalalaaa
Kwarde is offline  
Old 12/03/2011, 04:05 PM   #10
Compton
Big Clucker
 
Compton's Avatar
 
Join Date: Apr 2009
Posts: 165
Reputation: 6
Default Re: Help With class selection

Code:
public OnPlayerRequestClass(playerid, classid)
{
	switch(classid)
{
	case 0:
	{
	SetPlayerPos(playerid, 2527.9763,-1666.6794,15.1682);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 2522.4639,-1667.2499,15.0358);
	SetPlayerCameraLookAt(playerid, 2527.9763,-1666.6794,15.1682);
	GameTextForPlayer(playerid, "~g~Grove Street Families", 500, 3);
 	{
	case 1:
	{
	SetPlayerPos(playerid, 320.1396,1122.7827,1083.8828);
	SetPlayerFacingAngle(playerid,100.0);
	SetPlayerCameraPos(playerid, 320.2842,1118.7600,1083.8828);
	SetPlayerCameraLookAt(playerid, 320.1396,1122.7827,1083.8828);
	GameTextForPlayer(playerid, "~b~Front Yard Ballas", 500, 3);
	}
	return 1;
}
This didnt work aswel, shows up a error..

C:\Documents and Settings\Admin\desktop\RP\gamemodes\CPT.pwn(107) : error 014: invalid statement; not in switch
C:\Documents and Settings\Admin\desktop\RP\gamemodes\CPT.pwn(107) : warning 215: expression has no effect
C:\Documents and Settings\Admin\desktop\TO RP\gamemodes\CPT.pwn(107) : error 001: expected token: ";", but found ":"
C:\Documents and Settings\Admin\desktop\TO RP\gamemodes\CPT.pwn(107) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Admin\desktop\TO RP\gamemodes\CPT.pwn(107) : fatal error 107: too many error messages on one line

Line 107 is: case 1:
Compton is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] Class Selection - Showing the class name? CrucixTM Scripting Help 13 26/04/2012 06:38 PM
Class selection SampStunta Help Archive 4 22/09/2010 10:01 PM
help me with Class Selection Showing the class name The_Cobra Help Archive 2 05/02/2010 06:22 PM
Help WIth Class Selection wilcock33 Help Archive 9 12/12/2009 12:28 PM
[Help] Class Selection Benne Help Archive 1 10/11/2009 09:07 PM


All times are GMT. The time now is 11:42 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.