26.02.2011, 22:16
Hi. I have now for some time tried to figure out how to save letters instead of numbers. I want to allow people to choose what class they want to join as when they first join the server. Players will be able to choose from cowboy, indian and mexican.
Here is how my code current looks like:
As you can see I save pClass as numbers. What I want to do instead is save it as letters. Such as case 0 could look like this:
How can I do this?
Thanks.
Here is how my code current looks like:
pawn Код:
if (dialogid == 3)
{
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
PlayerInfo[playerid][pClass] = 1;
}
case 1:
{
PlayerInfo[playerid][pClass] = 2;
}
case 2:
{
PlayerInfo[playerid][pClass] = 3;
}
// Add the rest of your listitems for dialog 1 here
}
}
return 1;
}
pawn Код:
case 0: // Listitems start with 0, not 1
{
PlayerInfo[playerid][pClass] = "Cowboy";
}
Thanks.