String only shows first-letter.
#1

Sup, i've got the commands working.. sort of.. now i just need one more tad of help...

If i do /cylinder <Kabuuu> it only shows: Cylinder: K. Anyone know whats wrong with it?

pawn Код:
dcmd_cylinder(playerid, params[])
{
    new
        string[128];
    if (sscanf(params, "s", string))
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/cylinder <cylinder name>\"");
        } else { ScooterCylinder[playerid] = params[playerid];
    }
    return 1;
}
Reply
#2

the indention isnt good and the code doesnt make sense to me

just tell whats the command should do and what the array ScooterCylinder should store
Reply
#3

Player uses /cylinder <cylinder name>
Player's Cylinder Stats becomes <cylinder name he had chosen>

i.e /checkcylinder <playerid>

"Player: Dude102's Cylinder is: <Cylinder name he had chosen>..

Get me?

Edit: don't mind the indentation, i'll fix that later .
Reply
#4

first of all we need a 2d array to store a string for each player
pawn Код:
new ScooterCylinder[MAX_PLAYERS][MAX_PLAYER_NAME];
and than we store the text with the function format in ScooterCylinder
pawn Код:
dcmd_cylinder(playerid, params[])
    if(params[0] == EOS || strlen(params) >= sizeof(ScooterCylinder[]))
        return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/cylinder <cylinder name>\"");
    else    return format(ScooterCylinder[playerid], sizeof(ScooterCylinder[]), params);
and /checkcylinder need to look something like that
pawn Код:
dcmd_checkcylinder(playerid, params[])
{
    //some checks to get the playerid which was typed in (I call it now pid)
    new string[128];
    GetPlayerName(pid, string, MAX_PLAYER_NAME);
    format(string, sizeof(string), "Player: %s's Cylinder is: %s..", string, ScooterCylinder[pid]);
    return SendClientMessage(playerid, 0xFFFFFFAA, string);
}
Reply
#5

Ugh, i knew it wasnt correct, cheers mate..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)