Question about /ban [playerid] or /kick [playerid] - 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: Question about /ban [playerid] or /kick [playerid] (
/showthread.php?tid=608226)
Question about /ban [playerid] or /kick [playerid] -
Eymeric69 - 29.05.2016
Hi everyone i need a little help i don't know how to ban a player i have just founded that on the wiki
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/banme", true) == 0)
{
// Ban the player that types this command.
Ban(playerid);
return 1;
}
}
but me i want that :
PHP код:
CMD:ban(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(playerid))
{
// here ban the player
}
else
{
SendClientMessage(playerid, 0xAA3333AA,"[ERREUR]Ce joueur n'est pas connectй.");
}
}
return 1;
}
thank for the help
Re: Question about /ban [playerid] or /kick [playerid] -
Dayrion - 29.05.2016
Hey.
This is a simple command. Check this:
PHP код:
/*
On utilise ici sscanf2 & zcmd. Deux fonctions qui sont grandement utiles.
#include <zcmd>
#include <sscanf2>
*/
CMD:ban(playerid, params[])
{
new cible;
if(IsPlayerAdmin(playerid)) // Vйrification de si le joueur est admin
{
if(sscanf(params, "u", cible)) return SendClientMessage(playerid, 0xAA3333AA,"[ERREUR] /ban [playerid/name]");
if(IsPlayerConnected(cible)) // Vйrification de si le joueur cible est connectй
{
Ban(cible); // On ban le joueur ciblй - Il sera ajoutй а la liste samp.ban
}
else
{
SendClientMessage(playerid, 0xAA3333AA,"[ERREUR]Ce joueur n'est pas connectй.");
}
}
return 1;
}
// ---------------------------------------------------------------------------------------------------------------------------------
// Voici une deuxiиme version de ta commande un peu plus "optimisйe" en place.
CMD:ban(playerid, params[])
{
new cible;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAA3333AA,"[ERREUR] Vous devez кtre administrateur"); // Le '!' signifie l'inverse donc : si le joueur N'EST PAS admin alors on return un message d'erreur
if(sscanf(params, "u", cible)) return SendClientMessage(playerid, 0xAA3333AA,"[ERREUR] /ban [playerid/name]"); // Mкme principe
if(!IsPlayerConnected(cible)) return SendClientMessage(playerid, 0xAA3333AA,"[ERREUR]Ce joueur n'est pas connectй."); // Mкme principe
Ban(cible); // On ban le joueur ciblй
return 1;
}
Re: Question about /ban [playerid] or /kick [playerid] -
Eymeric69 - 29.05.2016
multiple errors
Код:
C:\Users\mickael\Desktop\Serveur SCP\gamemodes\SCPRP.pwn(145) : error 017: undefined symbol "cible"
C:\Users\mickael\Desktop\Serveur SCP\gamemodes\SCPRP.pwn(146) : error 017: undefined symbol "cible"
C:\Users\mickael\Desktop\Serveur SCP\gamemodes\SCPRP.pwn(147) : error 017: undefined symbol "cible"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
thank you
Re: Question about /ban [playerid] or /kick [playerid] -
Dayrion - 29.05.2016
Forgot something, my bad. Check my last post.
Re: Question about /ban [playerid] or /kick [playerid] -
Rubey - 29.05.2016
C'est quoi le soucis ? Pas compris.
Re: Question about /ban [playerid] or /kick [playerid] -
Dayrion - 29.05.2016
Quote:
Originally Posted by Rubey
C'est quoi le soucis ? Pas compris.
|
Il se demandait comment mettre un paramиtre dans une commande.
The question was, how to put a parameter in a command.