What is wrong with my command? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What is wrong with my command? (
/showthread.php?tid=164725)
What is wrong with my command? -
scott1 - 01.08.2010
Hi all, i make an command /rename into french, but if the name already exist name change or i put condition id exist we don't change name.
pawn Код:
if(strcmp(cmd, "/changernom", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new tmpp[256];
tmpp = strtok(cmdtext, idx);
if(!strlen(tmpp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
return 1;
}
giveplayerid = strval(tmpp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "users/%s.ini", tmp);
if(fexist(string))
{
SendClientMessage(playerid, COLOR_YELLOW, "Ce pseudo existe dйjа.");
return 1;
}
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(giveplayerid))
{
new namestring = strfind(tmp, "_", true);
if(namestring == -1)
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
return 1;
}
else
{
SetPlayerName(giveplayerid, tmp);
format(string,sizeof(string),"users/%s.ini",giveplayer);
fremove(string);
format(string, sizeof(string), "AdmCMD: %s(%i) a changй votre nom en %s", sendername, playerid, tmp);
SendClientMessage(giveplayerid, COLOR_DBLUE, string);
format(string, sizeof(string), "AdmCMD: Vous avez changer le nom de l'id %i en %s", giveplayerid, tmp);
SendClientMessage(playerid, COLOR_DBLUE, string);
format(string, 256, "AdmWarning: %s а changй le nom de %s en %s.", sendername,giveplayer, tmp);
ABroadCast(COLOR_YELLOW,string,1);
SauvegardeCompte(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Ce joueur n'est pas connectй!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Vous n'кtes pas autorisй a utiliser cette commande!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Vous devez йtre connectй!");
}
return 1;
}
Please help me
Re: What is wrong with my command? -
[MWR]Blood - 01.08.2010
Man use [ pawn] for PAWN codes, we can't see a shit.
And explain more please, I didn't understand anything. :/
Re : What is wrong with my command? -
scott1 - 02.08.2010
Ok, so i made this command to change player names.
I want when the name is already used it doesn't change name,
so i did this
pawn Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changernom [playerid] [nouveau nom (Prenom_Nom)]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "users/%s.ini", tmp);
if(fexist(string))
{
SendClientMessage(playerid, COLOR_YELLOW, "Ce pseudo existe dйjа.");
return 1;
}
but when the account already exist i don't said me already exist, it change name, but normaly with the code he don't have to because account already exist
Re: What is wrong with my command? -
sk0t - 02.08.2010
Hrmmm has your GameMode got a function to check if a player account exists under a certain name?