Interesting issue..(go have a look please) -
trablon - 03.04.2015
Okay guys, i have a problem in my gamemode.
For example;
I'm trying to show information about variables of a player in a dialog..
pawn Код:
CMD:ticket(playerid, params[])
{
new id,value,string[256],reasona[256];
if(pInfo[playerid][cop] != 1) return SCM(playerid,COLOR_LIGHTRED,"You are not a cop.");
if(sscanf(params, "uds[256]", id,value,reasona)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /ticket [Player ID/Player Name] [Value] [Reason]");
if(!ProxDetectorS(5.0, playerid, id)) { return SCM(playerid,COLOR_LIGHTRED,"* You have to be close to player."); }
pInfo[id][ticketvalue] += value;
pInfo[id][reason] = reasona;
return 1;
}
Everything is fine from this moment..
Now, i want to show info for player.
pawn Код:
CMD:mytickets(playerid, params[])
{
new tickett[256];
format(tickett,sizeof(tickett),"Ticket Value: %d\tTicket Reason:%s",pInfo[playerid][ticketvalue],pInfo[playerid][reason]);
Dialog_Show(id, tickett, DIALOG_STYLE_MSGBOX, "My Tickets", tickett, "OK", "");
return 1;
}
From this moment, everything is good.But what i want is: when a cop gives his second ticket to a player, player must see his first and second or more tickets in the /mytickets command.
Waiting for a response for it.
Re: Interesting issue..(go have a look please) -
CalvinC - 03.04.2015
First you need to create "tickets" in your array, and then make the ticketvalue and reason a 3D array with the size of your max amount of tickets.
Then:
Код:
// When he receives a ticket, increase the array by 1
pInfo[playerid][tickets] ++;
CMD:mytickets(playerid, params[])
{
new tickett[168 * 4], strcatstring[168];
// Multiply by the amount of max tickets that can be displayed
for(new i = 0; i < pInfo[playerid][tickets]; i ++)
{
format(strcatstring, sizeof(strcatstring), "Ticket Value: %d\tTicket Reason:%s", pInfo[playerid][ticketvalue][i], pInfo[playerid][reason][i]);
strcat(tickett, strcatstring);
// strcat inserts the "strcatstring" that we just formatted, into the "tickett" array which we're gonna display
}
Dialog_Show(id, tickett, DIALOG_STYLE_MSGBOX, "My Tickets", tickett, "OK", "");
return 1;
}
Re: Interesting issue..(go have a look please) -
trablon - 03.04.2015
You are awesome! Thank you.