SA-MP Forums Archive
Some Problems and Help ! - 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)
+--- Thread: Some Problems and Help ! (/showthread.php?tid=468674)



Some Problems and Help ! - MAFIAWARS - 09.10.2013

Hello!
I want that Command from which Admin wear its Admin Color by doing this:

/admincolor <1 or 0>

When Admin do /admincolor 1, Its Admin Color should be ON and When He 'll do /admincolor 0, His Admin Color should get OFF.

I made /wearadmincolor & /unwearadmincolor Command but I want to make On and OFF system in one command.

Any Help?

And Also my Kick Command is making Problem.

pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) Kick(playerid);
CMD:kick(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] < 1 ) return 0;
    new giveplayerid, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    new str_[128];
    if( GetPlayerVirtualWorld( playerid ) != 0 ) return SendClientMessage( playerid, COLOR_RED, "[ ! ] You can't use Admin Commands in Virtual World !" );
    if(sscanf(params,"us[128]",giveplayerid,params)) return SendClientMessage(playerid, COLOR_RED1,"[ ! ] USAGE: /kick <playerid/partofname> <reason>");
    if(!IsPlayerConnected(giveplayerid)) 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);
    format(str_,sizeof(str_), "[ ! ] You are kicked by %s for '%s'", Name1, params);
    SetTimerEx("KickPublic", 4000, 0, "d", giveplayerid);
    SendClientMessage(giveplayerid, COLOR_WS, str_);
    SendClientMessageToAll(COLOR_WS,params);
    Kick(giveplayerid);
    return 1;
}
It is not Showing the Victim that: "You are kicked by %s for %s" but It is just kicking the Player.

And Also I've the Player with /ekick Command (To kick the Player from Virtual World).

pawn Код:
CMD:ekick(playerid, params[])
{
    if(GetPlayerVirtualWorld(playerid) != 1) return SendClientMessage( playerid, COLOR_RED, "[ ! ] You can't use Event Commands in Real World !");
    new giveplayerid, PlayerName[MAX_PLAYER_NAME], str_[100];
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "[ ! ] USAGE: /ekick <playerid>");
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(GetPlayerVirtualWorld(giveplayerid) != 1) return SendClientMessage( playerid, COLOR_RED, "[ ! ] This Player is not in Event !" );
    SetPlayerVirtualWorld(giveplayerid, 0);
    format(str_, 62, "[ ! ] %s has been kicked out from the event !", PlayerName);
    SendClientMessageToAll(COLOR_EVENT, str_);
    SendClientMessage(giveplayerid, COLOR_EVENT, "[ ! ] You have been kicked out from the Event !");
    return 1;
}
The Problem in this Command is, When I am kicking the Player, It is kicked but the Client Message is not showing Correctly.

Like: I kicked ID 1 and His name is "TesT" so it will show like that to All Players.

MAFIA_WARS has been kicked out from the Event

But I don't get kicked. But the Target has been kicked. So that is the problem.

P.S: I want /me and /shout Command too help!


Re: Some Problems and Help ! - JimmyCh - 09.10.2013

Okay, how about showing us what you've done so far? This section is Scripting Help not request a script.
Show us what you've done so far, don't just tell us you want /me and /shout commands, or /admincolor commands, we ain't scripting machines.
So show us what you've done so far so we can "help" you finish your code.


Re: Some Problems and Help ! - MAFIAWARS - 09.10.2013

Ok help about /kick Command and /ekick COmmand as given above?


Re: Some Problems and Help ! - MAFIAWARS - 10.10.2013

HELPPPPPPPPPPPPPPPPPPPPPP


Re: Some Problems and Help ! - SilentSoul - 10.10.2013

You need to set a timer before kick to send to the player then kick him , use this stock
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) Kick(playerid);
 
stock KickWithMessage(playerid, color, message[])
{
    SendClientMessage(playerid, color, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);
    Kick(playerid);
}