Jump to content

Question

Posted

Am incercat sa fak o comanda....

un fel de announce

codul este asta

	if(strcmp("/an",cmdtext,true) ==0)
	{
	new message[256];
	new name[MAX_PLAYER_NAME];
	new annmsg[24];
	strmid(message, cmdtext, 3, strlen(cmdtext));
	GetPlayerName(playerid,name,sizeof(name));
	if(!strlen(message))
	{
	SendClientMessage(playerid,COLOR_RED,"|||||Use /an text if you want to add a announce!");
	}
	else
	{
	format(annmsg,sizeof(annmsg),"Announce new placed by %s:%s(id:%s)",name,message,playerid);
	SendClientMessageToAll(COLOR_RED,annmsg);
	printf(annmsg);
	}
    return 1;
	}

nu da eroare nimic dar cand scriu /an textul meu zice Messaju meu...ca nu exista comanda sa incerc /help de cE?>....

trebuie sa il fac cumva in dcmd?..

New GameMode In Development!-Romania Team Gang War-100%!...Datimi doua Motive afrimative de ce sa-l postez si-l postez...

7 answers to this question

Recommended Posts

Guest PlayON
Posted

Problema este:

strmid(message, cmdtext, 3, strlen(cmdtext));

Foloseste ZCMD si SSCANF deoarece este mai usor~!

Posted

o sa incerc ...ms..

da...dar nu prea am inteles din tutorialul facut de tine :((.....nu stiu cum as putea face prin zcmd :(am incercat sa fak normal...

New GameMode In Development!-Romania Team Gang War-100%!...Datimi doua Motive afrimative de ce sa-l postez si-l postez...

Posted

Incearca asa:

NORMAL:

if(strcmp("/an",cmdtext,true) ==0)
{
	new message[128], name[MAX_PLAYER_NAME], annmsg[24];
	strmid(message, cmdtext, 3, strlen(cmdtext));
	if( !strlen( strval(message) ) ) return SendClientMessage(playerid,COLOR_RED,"|||||Use /an text if you want to add a announce!");

	GetPlayerName(playerid,name,sizeof(name));

	format(annmsg,sizeof(annmsg),"Announce new placed by %s:%s(id:%s)",name,strval(message),playerid);
	SendClientMessageToAll(COLOR_RED,annmsg);
	printf(annmsg);
	return 1;
}
ZCMD:
CMD:an(playerid, params[])
{
	if( sscanf(params, "s", params[0]) ) return SendClientMessage(playerid,COLOR_RED,"|||||Use /an text if you want to add a announce!");

	new message[128], name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, MAX_PLAYER_NAME );
	format(message, 128,"Announce new placed by %s:%s(id:%s)", name, params[0], playerid);
	SendClientMessageToAll(COLOR_RED, message);
	printf(message);
	return 1;
}

Vei observa cat de simplu este cu ZCMD.

Posted

ms mult stuntman ;)esti cel mai tare si mersi si tie Zher0 si tu mi-ai dat o sugestie dar  nu prea am priceput

P.S:stuntman +1 respect din partea mea ;) ti-am mai dat si tie Zher0 ;)

DAR DA o eroare la ce ai dat stuntman argument mismatch vad ca ai omis ceva ...dar nu stIU CE la linia

	if( !strlen( strval(message) ) ) return SendClientMessage(playerid,COLOR_RED,"|||||Use /an text if you want to add a announce!");

DAR STai ca fac cu zcmd..

Edit:A mers...numai da eror..am incercat cu zcmd...

dar acum zice Announce new placed by %s(Id:Nu il mai zice)si textu nici atat.cum fak :(?

New GameMode In Development!-Romania Team Gang War-100%!...Datimi doua Motive afrimative de ce sa-l postez si-l postez...

Guest PlayON
Posted

TheBoss" post="62583" timestamp="1301052224"]

ms mult stuntman ;)esti cel mai tare si mersi si tie Zher0 si tu mi-ai dat o sugestie dar  nu prea am priceput

P.S:stuntman +1 respect din partea mea ;) ti-am mai dat si tie Zher0 ;)

DAR DA o eroare la ce ai dat stuntman argument mismatch vad ca ai omis ceva ...dar nu stIU CE la linia

	if( !strlen( strval(message) ) ) return SendClientMessage(playerid,COLOR_RED,"|||||Use /an text if you want to add a announce!");

DAR STai ca fac cu zcmd..

Edit:A mers...numai da eror..am incercat cu zcmd...

dar acum zice Announce new placed by %s(Id:Nu il mai zice)si textu nici atat.cum fak :(?

Schimba ultimul %s in %d deoarece playerid este un integer!

Guest PlayON
Posted

TheBoss" post="62626" timestamp="1301068907"]

ms merge :)dati TP

OMG...Nu mai ziceti TP! Orice ar fi TP!

Se zice Topic Solved!

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.