SA-MP Forums Archive
I require help.. - 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: I require help.. (/showthread.php?tid=73399)



I require help.. - Mayo - 14.04.2009

Hi, I'm new to scripting PAWN so I require a little help..

Okay, here's the problem:

How do I add text when I'm selecting classes?

For example, I select the Police class; I want it to say 'POLICE OFFICER' above.

Thank-you!
- Mayo.


Re: I require help.. - OmeRinG - 14.04.2009

In order to do that you must know the following:
the classid
OR
the skinid

skinid = The ID of the skin.
classid = The numer of the class, for example if I did this:
AddPlayerClass(73,...);
AddPlayerClass(75,...);
'... stands for cordinates weapons etc... not required for this example

And 75 is a skin of a policeman (it is not, it's just an example), then the classid is 2, and the skin id is 75.

so now that you know what is each, do the following:
in the public OnPlayerRequestClass(playerid,classid)

if you want to work with classid:
pawn Код:
switch(classid)
{
    case 0..3: {
        GameTextForPlayer(playerid, "grove", 1000, 5);
    }
    case 10..17: {
        GameTextForPlayer(playerid, "ballas", 1000, 5);
    }
    case 18..20: {
        GameTextForPlayer(playerid, "Police", 1000, 5);
    }
}
This code means:
if the class id is from 0 to 3 (0 or 1 or 2 or 3) then write "Grove"
if the class is from 10 to 17 (10 or 11 or 12 or 13 and so on) then write Ballas...
same thing with 18..20

if you want to go by Skinid then do the following:
pawn Код:
new skinid = GetPlayerSkin(playerid);
    switch(skinid)
    {
        case 0,5,4,3: {
            GameTextForPlayer(playerid, "abc", 1000, 5);
        }
        case 8,2,8,9: {
            GameTextForPlayer(playerid, "efg", 1000, 5);
        }
        case 25,78,92: {
            GameTextForPlayer(playerid, "hijk", 1000, 5);
        }
        case 18,54,21: {
            GameTextForPlayer(playerid, "lmnop", 1000, 5)
        }
    }
This means that if the skinid of the player is 0 or 5 or 4 or 3 then write "abc" and so on...

hope you understood, good luck.



Re: I require help.. - nickbugun - 14.04.2009

You have to make Teams if you want it to look better.
Anway

Add this to OnPlayerSpawn
Quote:

new string[50];
new name[MAX_PLAYER_NAME];
if(GetPlayerSkin(playerid) == POLICESKIN) //CHANGE POLICE SKIN TO YOUR POLICE`S SKIN
{
format(string, sizeof(string), "Welcome to Officer: %d", name);
SendClientMessageToAll(0x00FF00AA, string);
}




Re: I require help.. - russiany - 14.04.2009

NICKBUGUN .. there's something wrong .. where's the GetPlayerName , and it's not %d ( integer ) it's %s ( str )


Re: I require help.. - Eradicator - 14.04.2009

Err Nick.. That isn't what he asked for, and you used an int (%d) in the format message so it wouldn't say his name.

EDIT: Damn, russiany beat me to it.


Re: I require help.. - Mayo - 15.04.2009

Thank-you!

Sorry about the Double-post, I was a bit confused on which topic to put it under;

Anyway, Thanks a bunch!
- Mayo.


Re: I require help.. - HB - 15.04.2009

Quote:
Originally Posted by nickbugun
You have to make Teams if you want it to look better.
Anway

Add this to OnPlayerSpawn
Quote:

new string[50];
new name[MAX_PLAYER_NAME];
if(GetPlayerSkin(playerid) == POLICESKIN) //CHANGE POLICE SKIN TO YOUR POLICE`S SKIN
{
format(string, sizeof(string), "Welcome to Officer: %d", name);
SendClientMessageToAll(0x00FF00AA, string);
}

Quote from the rules:
Quote:

When responding to coding questions make sure your code works first.