SA-MP Forums Archive
Barman work command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Barman work command (/showthread.php?tid=249809)



Barman work command - NitoPSG - 20.04.2011

I want to make something but i don't know if thais is possible, i want to make a command that will give beer to other people, for excable someone is in the bar of zizzy's like barman and want to give a beer in other player, typing /givebeer [player id], and then a beer will appear to the id player, can i make this


Re: Barman work command - Vince - 20.04.2011

pawn Код:
CMD:givebeer(playerid, params[])
{
    new uid;

    if(sscanf(params, "u", uid))
        return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /givebeer <playerid/partofname>");

    if(uid == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, COLOR_YELLOW, "Player not connected.");

    SetPlayerSpecialAction(uid, SPECIAL_ACTION_DRINK_BEER);
    return 1;
}



Re: Barman work command - NitoPSG - 20.04.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
CMD:givebeer(playerid, params[])
{
    new uid;

    if(sscanf(params, "u", uid))
        return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /givebeer <playerid/partofname>");

    if(uid == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, COLOR_YELLOW, "Player not connected.");

    SetPlayerSpecialAction(uid, SPECIAL_ACTION_DRINK_BEER);
    return 1;
}
i don't use CMD


Re: Barman work command - NitoPSG - 21.04.2011

LOL!!


Re: Barman work command - NitoPSG - 21.04.2011

LOL xD, I tried to make it in this way, but doesn't work, and all my other commands stop to work xD, But i didn't get errors in compile:

Код:
        new giveplayerid;
        new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	if (strcmp("/giveit", cmdtext, true, 10) == 0)
	{
	 	if (IsPlayerConnected(giveplayerid))
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_DRINK_BEER);
	}
	else
	{
        SendClientMessage(playerid, 0xFFFF00AA, "Invalid transaction amount.");
		return 1;
	}
Tell me what i did wrong, what i miss, and what i must do? (sorry guys, i am a noob xD)


Re: Barman work command - NitoPSG - 21.04.2011

Quote:
Originally Posted by NitoPSG
Посмотреть сообщение
LOL xD, I tried to make it in this way, but doesn't work, and all my other commands stop to work xD, But i didn't get errors in compile:

Код:
        new giveplayerid;
        new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	if (strcmp("/giveit", cmdtext, true, 10) == 0)
	{
	 	if (IsPlayerConnected(giveplayerid))
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_DRINK_BEER);
	}
	else
	{
        SendClientMessage(playerid, 0xFFFF00AA, "Invalid transaction amount.");
		return 1;
	}
Tell me what i did wrong, what i miss, and what i must do? (sorry guys, i am a noob xD)
Any help? :/