SA-MP Forums Archive
Print text after selecting class - 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)
+--- Thread: Print text after selecting class (/showthread.php?tid=392322)



Print text after selecting class - Pawnstar - 13.11.2012

pawn Код:
public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Learner Script, Select your class, Some have advantages.");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    print("You have selected CJ, This class has no perks and spawns with nothing);
    AddPlayerClass(285, 1958.3783, 1343.1572, 15.3746, 269.1425, 13, 100, 19, 100, 0, 0);
    print("
You have selected SWAT, This class spawns with some weapons);
    AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
    print("You have selected Balla, This is a gang member with little weapons);
    return 1;
}
Wasn't sure what i should actually do but i thought this would be right?
But end up getting..

Код:
C:\Users\Ash.Ash-PC\Desktop\Learning\gamemodes\Learner.pwn(39) : error 037: invalid string (possibly non-terminated string)
C:\Users\Ash.Ash-PC\Desktop\Learning\gamemodes\Learner.pwn(39) : error 017: undefined symbol "You"
C:\Users\Ash.Ash-PC\Desktop\Learning\gamemodes\Learner.pwn(39) : error 017: undefined symbol "have"
C:\Users\Ash.Ash-PC\Desktop\Learning\gamemodes\Learner.pwn(39) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Also one more question, How do i make a class spawn with some dollars?

Thanks


Re: Print text after selecting class - tyler12 - 13.11.2012

pawn Код:
public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Learner Script, Select your class, Some have advantages.");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    print("You have selected CJ, This class has no perks and spawns with nothing");
    AddPlayerClass(285, 1958.3783, 1343.1572, 15.3746, 269.1425, 13, 100, 19, 100, 0, 0);
    print("You have selected SWAT, This class spawns with some weapons");
    AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
    print("You have selected Balla, This is a gang member with little weapons");
    return 1;
}
This will print the text in the console.


Re: Print text after selecting class - Pawnstar - 13.11.2012

Oh my bad, would i do Sendclientmessage(etc);


Re: Print text after selecting class - InfiniTy. - 13.11.2012

Quote:
Originally Posted by Pawnstar
Посмотреть сообщение
Oh my bad, would i do Sendclientmessage(etc);
Yep.. something like
SendClientMessage(playerid,-1,"Message");
And if you have a color replace -1 with your color


Re: Print text after selecting class - tyler12 - 13.11.2012

Quote:
Originally Posted by Pawnstar
Посмотреть сообщение
Oh my bad, would i do Sendclientmessage(etc);
You would do SendClientMessage(playerid, color, message[]); OnPlayerRequestClass. Classes are given a ID. Starts from 0 and so on. So

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        SendClientMessage(playerid, -1, "You have selected CJ, This class has no perks and spawns with nothing");
    }
    else if(classid == 1)
    {
        SendClientMessage(playerid, -1, "You have selected SWAT, This class spawns with some weapons");
    }
    else if(classid == 2)
    {
        SendClientMessage(playerid, -1, "You have selected Balla, This is a gang member with little weapons");
    }
    return 1;
}



Re: Print text after selecting class - Pawnstar - 13.11.2012

Thanks, I got that kinda working, However when i enter the server there is no preview of which class im using? Anyone know what i mean? Im starting from a blank script also if that helps


Re: Print text after selecting class - tyler12 - 13.11.2012

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1999.2517, -755.3153, 129.1501);
    SetPlayerCameraPos(playerid, 1999.2517, -755.3153, 129.1501);
    SetPlayerCameraLookAt(playerid, 1999.2517, -755.3153, 129.1501);
    SetPlayerFacingAngle(playerid, 108.0085);
    if(classid == 0)
    {
        SendClientMessage(playerid, -1, "You have selected CJ, This class has no perks and spawns with nothing");
    }
    else if(classid == 1)
    {
        SendClientMessage(playerid, -1, "You have selected SWAT, This class spawns with some weapons");
    }
    else if(classid == 2)
    {
        SendClientMessage(playerid, -1, "You have selected Balla, This is a gang member with little weapons");
    }
    return 1;
}