Help in making function... -
MAFIAWARS - 28.09.2013
Hello Again.
I want to make that Function that SendClientMessageToAll only in Virtual World.
For Example, I made /ekick Command and made SendClientMessageToAll that "MAFIA_WARS has been kicked out from the event" But This Message is also showing to those who aren't in Virtual World.
But I want that, This message should be shown to that Players Who are in Event...
So Any One can Help me?
Re: Help in making function... -
Konstantinos - 28.09.2013
Just to let you know. They are all called 'Virtual World' to SA-MP. If you want to be specific, say to those who are in virtual world N (N = a number that the players from the even are in). We simply don't know what virtual world you use for your event.
pawn Код:
stock SendEventMessageToAll( color, const message[ ] )
{
for( new j = 0; j < MAX_PLAYERS; j++ ) if( GetPlayerVirtualWorld( j ) != 0 ) SendClientMessage( j, color, message );
}
Re: Help in making function... -
MAFIAWARS - 28.09.2013
Thanks Man !
As you really helped me alot so I will not hesitate you to ask one more question
I am getting Problem in /kick Command...
here it is:
pawn Код:
CMD:kick(playerid,params[])
{
if(pInfo[playerid][pAdminLevel]> 1 ) return 0;
new giveplayerid;
Name1[MAX_PLAYER_NAME]Name2[MAX_PLAYER_NAME]; //Line 807
if(sscanf(params,"us[128]",giveplayerid,params)) return SendClientMessage(playerid, COLOR_RED1,"[ ! ] USAGE: /kick <playerid/partofname> <reason>");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED,"[ ! ] Player is not connected !");
GetPlayerName(playerid,Name1,sizeof(Name1));
GetPlayerName(giveplayerid,Name2,sizeof(Name2));
format(params,129, "[ ! ] %s has been kicked by %s for %s",Name2,Name1,params);
SendClientMessageToAll(COLOR_WS,params);
Kick(giveplayerid);
return 1;
}
Finding these Errors:
pawn Код:
E:\SCRIPT\gamemodes\Dafuq.pwn(807) : error 017: undefined symbol "Name1"
E:\SCRIPT\gamemodes\Dafuq.pwn(807) : warning 215: expression has no effect
E:\SCRIPT\gamemodes\Dafuq.pwn(807) : error 001: expected token: ";", but found "]"
E:\SCRIPT\gamemodes\Dafuq.pwn(807) : error 029: invalid expression, assumed zero
E:\SCRIPT\gamemodes\Dafuq.pwn(807) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Re: Help in making function... - Patrick - 28.09.2013
pawn Код:
new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME]; //Line 807
You forgot to put a
,(comma) to divide the variable. and you forgot to put
new
Re: Help in making function... -
Konstantinos - 28.09.2013
It should be a comma, but you used a semicolon instead and you did not use a comma on the last.
pawn Код:
new giveplayerid, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
Re: Help in making function... -
MAFIAWARS - 28.09.2013
Done, But Still Facing same Errors and Problems.
pawn Код:
CMD:kick(playerid,params[])
{
if(pInfo[playerid][pAdminLevel]> 1 ) return 0;
new giveplayerid, Name1[MAX_PLAYER_NAME]Name2[MAX_PLAYER_NAME]; //line 759
if(sscanf(params,"us[128]",giveplayerid,params)) return SendClientMessage(playerid, COLOR_RED1,"[ ! ] USAGE: /kick <playerid/partofname> <reason>");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED,"[ ! ] Player is not connected !");
GetPlayerName(playerid,Name1,sizeof(Name1));
GetPlayerName(giveplayerid,Name2,sizeof(Name2));
format(params,129, "[ ! ] %s has been kicked by %s for %s",Name2,Name1,params);
SendClientMessageToAll(COLOR_WS,params);
Kick(giveplayerid);
return 1;
}
Errors:
pawn Код:
E:\SCRIPT\gamemodes\Dafuq.pwn(759) : error 001: expected token: ";", but found "-identifier-"
E:\SCRIPT\gamemodes\Dafuq.pwn(759) : error 017: undefined symbol "Name2"
E:\SCRIPT\gamemodes\Dafuq.pwn(759) : warning 215: expression has no effect
E:\SCRIPT\gamemodes\Dafuq.pwn(759) : error 001: expected token: ";", but found "]"
E:\SCRIPT\gamemodes\Dafuq.pwn(759) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Re: Help in making function... -
Konstantinos - 28.09.2013
Your line:
pawn Код:
new giveplayerid, Name1[MAX_PLAYER_NAME]Name2[MAX_PLAYER_NAME]; //line 759
My line:
pawn Код:
new giveplayerid, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
You forgot the comma.
Re: Help in making function... -
MAFIAWARS - 28.09.2013
Thanks

You're Great
How can I make that Command for Admins, like /a hi (<text>) (so only admins can talk)...
And when they type some text, It should be like this...
[ ! ] MAFIA_WARS level 1: Hi
Re: Help in making function... -
Konstantinos - 28.09.2013
pawn Код:
CMD:a( playerid, params[ ] )
{
if( pInfo[ playerid ][ pAdminlevel ] < 1 ) return 1;
if( isnull( params ) ) return SendClientMessage( playerid, -1, "Usage: /a <text>" );
new
_string[ 128 ],
_name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, _name, MAX_PLAYER_NAME );
format( _string, sizeof( _string ), "[ ! ] %s level %d: %s", _name, pInfo[ playerid ][ pAdminlevel ], params );
for( new j = 0; j < MAX_PLAYERS; j++ ) if( pInfo[ j ][ pAdminlevel ] > 0 ) SendClientMessage( j, -1, _string );
return 1;
}
Re: Help in making function... -
MAFIAWARS - 28.09.2013
When I m doing in my game /a and typing Text, It is not showing anything...
Look,
And I pressed ENTER already...But It does nothing...