Can someone convert please? [FAST] - 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: Can someone convert please? [FAST] (
/showthread.php?tid=409388)
Can someone convert please? [FAST] -
VIP475 - 21.01.2013
pawn Код:
dcmd_changename(playerid, params[])
{
new name[MAX_PLAYER_NAME], newname[16];
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params,"s", newname)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /changename [new name]");
if(dini_Exists(newname)) return SendClientMessage(playerid, COLOUR_RED, "That name has already been taken!");
if(strlen(params) >= 3)
{
format(file, sizeof(file), "users/%s.txt", name);
dini_Set(file, "users/%s.txt", newname);
SendClientMessage(playerid, COLOUR_GREEN, "Your name has been successfully been changed");
SetPlayerName(playerid, newname);
}
else
{
SendClientMessage(playerid, COLOUR_YELLOW, "That name is too short, pick something else!");
}
return 1;
}
To strcmp?
AW: Can someone convert please? -
Blackazur - 21.01.2013
Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if (strcmp("/changename", cmdtext, true, 10) == 0)
{
new name[MAX_PLAYER_NAME], newname[16];
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params,"s", newname)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /changename [new name]");
if(dini_Exists(newname)) return SendClientMessage(playerid, COLOUR_RED, "That name has already been taken!");
if(strlen(params) >= 3)
{
format(file, sizeof(file), "users/%s.txt", name);
dini_Set(file, "users/%s.txt", newname);
SendClientMessage(playerid, COLOUR_GREEN, "Your name has been successfully been changed");
SetPlayerName(playerid, newname);
}
else
{
SendClientMessage(playerid, COLOUR_YELLOW, "That name is too short, pick something else!");
}
return 1;
}
I tested it not.