Problem with /vchat
#3

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Try this:
Код:
 #if !defined isnull
	#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
CMD:vchat(playerid,params[]){
    if(!V[playerid][vlevel]) return EMess(playerid);
    if(isnull(params)) return SCM(playerid,-1,"Use:/vchat [Text]");
    SendMessageToVips(playerid,params);
    return 1;
}

//Function here
//i like javascript and use #define function%0(%1) forward%0(%1); ..
function SendMessageToVips(id,const string[]){
    var str[145];
    GetPlayerName(id,str,MAX_PLAYER_NAME);
    format(str,sizeof(str),"{FFFF00}Vip Chat: %s say %s",str,string);
    for(var i; i<MAX_PLAYERS; i++){
        if(!IsPlayerConnected(i) || !V[i][vlevel]) continue;
        SCM(i,-1,str);
    }
    return 1;
}
PS: How do you declared var? I hope #define var new
Thanks you very much for your code.
1)sorry I did not tell you about the var was my fault, yes i have #define var new for var variable why i like javascript .
2)this code is very good
Код:
#if !defined isnull
	#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
but i like sscanf and my problem no in /vchat my problem in function SendMessageToVips and i fix this function with code:

Код:
function SendMessageToVips(id,string[]){
    var name[MAX_PLAYER_NAME],str[256];
    GetPlayerName(id,name,sizeof(name));
	for(var i=0; i<MAX_PLAYERS; i++){
	    if(IsPlayerConnected(i)){
	        if(V[i][vlevel] > 0){
	            format(str,sizeof(str),"{FFFF00}Vip Chat: %s say %s",name,string);
	            SCM(i,-1,str);
	        }
	    }
	}
	return 1;
}
Thanks you very much and thank you for your time.
Reply


Messages In This Thread
Problem with /vchat - by FplayerGR - 02.06.2015, 10:20
AW: Problem with /vchat - by Kaliber - 02.06.2015, 10:52
Re: AW: Problem with /vchat - by FplayerGR - 02.06.2015, 13:24

Forum Jump:


Users browsing this thread: 2 Guest(s)