Scripting help, please HELP!
#1

I use zcmd gamemode and i buy for 24/7 flowers.
How to create command zcmd /give flover to player?
Please help me!
Reply
#2

Hi!

Could you more explain ?
Reply
#3

If i bought flowers with shop, i can share flowers with other player..


example: /giveflowers [PlayerID]
Player gets flower and i lose flower.
I need this script.

(( Sorry i I do not speak much English. ))
Reply
#4

Код HTML:
	new
		index,
		cmd[20];
	cmd = strtok(cmdtext, index);
	if (strcmp(cmd, "/giveflower", true) == 0)
	{
		new
			tmp[20],
			id;
		tmp = strtok(cmdtext, index);
		if (strlen(tmp))
		{
			id = strval(tmp);
			if (IsPlayerConnected(id))
			{
				GivePlayerWeapon(id,14,1);
                                GivePlayerWeapon(playerid,14,0);
				SendClientMessage(id, 0x00FF00AA, "You have recived a flower!");
				SendClientMessage(playerid, 0x00FF00AA, "You have send a flower");
			}
			else
			{
				SendClientMessage(playerid, 0xFF0000AA, "Player not found");
			}
		}
		else
		{
			SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/giveflower <playerid>\"");
		}
		return 1;
	}
Reply
#5

I use zcmd gamemode, please create this command in zcmd please.
Reply
#6

Код HTML:
CMD:flowers(playerid, params[]) {
    new id, message[1024],szString[1024];
    if(sscanf(params,"ds[1024]",id,message))return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveflowers <playerid>");
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
    if(playerid != id) {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        new ReturnName[MAX_PLAYER_NAME];
        GetPlayerName(id, ReturnName, sizeof(ReturnName));
        format(szString,sizeof(szString), "You have send flowers to %s", ReturnName);
        SendClientMessage(playerid, 0xFFCC2299, szString);
        format(szString,sizeof(szString),"You have recived flowers from %s!",PlayerName);
        SendClientMessage(id, 0xFFFF22AA, szString);
        GivePlayerWeapon(id,14,1);
        GivePlayerWeapon(playerid,14,0);
    }
    else {
        SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot give the flowers for yourself! :O");
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by [HRD]Mar1
Посмотреть сообщение
Код HTML:
CMD:flowers(playerid, params[]) {
    new id, message[1024],szString[1024];
    if(sscanf(params,"ds[1024]",id,message))return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveflowers <playerid>");
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
    if(playerid != id) {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        new ReturnName[MAX_PLAYER_NAME];
        GetPlayerName(id, ReturnName, sizeof(ReturnName));
        format(szString,sizeof(szString), "You have send flowers to %s", ReturnName);
        SendClientMessage(playerid, 0xFFCC2299, szString);
        format(szString,sizeof(szString),"You have recived flowers from %s!",PlayerName);
        SendClientMessage(id, 0xFFFF22AA, szString);
        GivePlayerWeapon(id,14,1);
        GivePlayerWeapon(playerid,14,0);
    }
    else {
        SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot give the flowers for yourself! :O");
    }
    return 1;
}
Jesus! You need to learn how to use sscanf first before you post code that it will give him errors/warning.
pawn Код:
new id, message[1024],szString[1024];
if(sscanf(params,"ds[1024]",id,message))return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveflowers <playerid>");
Your usage is "/giveflowers <integer> <string of 1024>.
when it needs to be
pawn Код:
new id;
if(sscanf(params,"r",id))return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveflowers <playerid>");
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)