Help With class selection
#1

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.
Reply
#2

Try here:

https://sampwiki.blast.hk/wiki/AddPlayerClass
https://sampwiki.blast.hk/wiki/OnPlayerRequestClass
https://sampwiki.blast.hk/wiki/Random
Reply
#3

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..


Код:
   	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;
}
Reply
#4

Quote:
Originally Posted by Compton
Посмотреть сообщение
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..


Код:
   	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.
Reply
#5

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?
Reply
#6

pawn Код:
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.
Reply
#7

You should use a switch statement for that.
pawn Код:
switch(classid)
{
    case 0:
    {
         //do your stuff
    {
    case 1:
    {
         //do your stuff
    }
    return 1;
}
Reply
#8

like this??

Код:
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
Reply
#9

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

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

pawn Код:
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
Reply
#10

Код:
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:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)