Help with some very basics things
#2

You have to format the string to set it to a variable like this:

pawn Код:
format(var,sizeof(var),"%s",SettingData);
// Then format string and add var to it and send client message

new string[120];
format(string,sizeof(string),"This is a test message %s",var);
SendClientMessage(playerid,0xFFFFFFFF,string);
Here is an example of the /money command in ZCMD + SSCANF.
pawn Код:
CMD:money(playeird,params[])
{
    new pID,amount; // variables that we'll use later in the cmd.
    if(sscanf(params,"ud",pID,amount)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /money [playerid] [amount]"); // Checks if player hasn't typed the right syntax of the command.
    if(GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid,0xCCCCCCFF,"You don't have enough money."); // If player has less money than he put in amount, don't execulte further.
    GivePlayerMoney(pID,amount); // Give money to the other player.
    GivePlayerMoney(playeird,-amount); // Take away the amount that player gave to the other player.
    return 1;
}
Reply


Messages In This Thread
Help with some very basics things - by Jakare - 20.12.2013, 14:16
Re: Help with some very basics things - by Tayab - 20.12.2013, 15:25
Re: Help with some very basics things - by Jakare - 20.12.2013, 15:39

Forum Jump:


Users browsing this thread: 1 Guest(s)