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;
}
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;
}
Код 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;
}
|
new id, message[1024],szString[1024];
if(sscanf(params,"ds[1024]",id,message))return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveflowers <playerid>");
new id;
if(sscanf(params,"r",id))return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveflowers <playerid>");