Somekind of identity card(help!)
#1

Iam trying to create a command that shows all the basic info of the player, please help me iam very new to this scripting "thing" if you could teach me the ways of a scripter i would be very thankful!

any way what i got is the folowing:

Код:
CMD:id(playerid)
{

	new idvar[128];
	new org = (GetPVarInt(playerid, "porgani"));
	switch (org)
	{
		case 400:
		{
			"PSP";
		}
		case 401:
		{
			"Taliban";
		}
	}

	format(idvar, sizeof(idvar), "[Organization]: %s [Rank in Organization]: %s [Job]: ", org);

	SendClientMessage(playerid, -1, idvar);
	return 1;
}
I already created a organization called PSP, and it's id is 400, and what i wanted was to associate in some way that number to a word, so that when the whole message shows it doenst show [Organization]: 400, for example, what i want is [Organization]: PSP......

if some one has any type of advice please, tell me! i am open to any opinion or advice about mistakes or ways to improve my coding abilities!

Any way, Thanks

Best Regards Sagoza
Reply
#2

You need to make a string, check the number of the organization, then associate a name with it. For example, this should work:

pawn Код:
CMD:id(playerid)
{

    new idvar[128];
    new org = (GetPVarInt(playerid, "porgani"));
    new string[8];
    switch (org)
    {
        case 400:
        {
            format(string, sizeof(string), "PSP");
        }
        case 401:
        {
            format(string, sizeof(string), "Taliban");
        }
    }

    format(idvar, sizeof(idvar), "[Organization]: %s [Rank in Organization]: %s [Job]: ", string);

    SendClientMessage(playerid, -1, idvar);
    return 1;
}
Obviously untested
Reply
#3

Holy baba ganoush, It worked!..

im very bad at this, but, yeah Thanks alot Stevolas, +rep
Reply
#4

Great that it worked mate. If you continue, you can fill in the rest of the variables like this:

Код:
format(idvar, sizeof(idvar), "[Organization]: %s [Rank in Organization]: %s [Job]: ", string, ANOTHERSTRING);
It will follow the order of the %s, %d, %i's.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)