SetPlayerName Error -
mrtms - 27.10.2013
Person_Person:/aduty
[00:47:11] [debug] Server crashed while executing rp.amx
[00:47:11] [debug] AMX backtrace:
[00:47:11] [debug] #0 native SetPlayerName () [100056f0] from sscanf.DLL
[00:47:11] [debug] #1 000e001c in ?? () from TGRP.amx
[00:47:11] [debug] #2 000dfcc0 in public cmd_aduty () from TGRP.amx
[00:47:11] [debug] #3 native CallLocalFunction () [00471e90] from samp-server.exe
[00:47:11] [debug] #4 0000136c in public OnPlayerCommandText () from TGRP.amx
[00:47:11] [debug] System backtrace:
[00:47:11] [debug] #0 10005769 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\sscanf.DLL
[00:47:11] [debug] #1 004010b6 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\samp-server.exe
[00:47:11] [debug] #2 6d6039e2 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #3 6d605e26 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #4 6d5fbf3f in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #5 6d603a0e in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #6 0047219e in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\samp-server.exe
[00:47:11] [debug] #7 004010b6 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\samp-server.exe
[00:47:11] [debug] #8 6d6039e2 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #9 6d605e26 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #10 6d5fbf3f in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #11 6d603a0e in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\plugins\crashdetect .DLL
[00:47:11] [debug] #12 0046cc20 in ?? () from C:\Users\s\Desktop\s\SAMP\TuRP\samp-server.exe
[00:47:11] [debug] #13 004527d0 in ?? () from C:\Users\s\Desktop\s\SAMP\TurRP\samp-server.exe
[00:47:11] [debug] #14 72bc3c1b in ?? () from C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a 1e18e3b_9.0.30729.6871_none_50944e7cbcb706e5\MSVCR 90.dll
[00:47:11] [debug] #15 72bc3c3a in ?? () from C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a 1e18e3b_9.0.30729.6871_none_50944e7cbcb706e5\MSVCR 90.dll
No idea why it's doing this...
here's the code too:
Код HTML:
COMMAND:aduty(playerid, params[]) return cmd_adminduty(playerid, params);
COMMAND:adminduty(playerid, params[])
{
if(!IsAdmin(playerid, 1)) return NoCMD(playerid);
if(PlayerInfo[playerid][pAdminDuty] == 0) {
GetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]);
PlayerInfo[playerid][pInterior] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
PlayerInfo[playerid][pAdminDuty] = 1;
SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
SendClientMessage(playerid, COLOR_GRAD3, "You have successfully went on admin duty.");
}else{
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
SetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
PlayerInfo[playerid][pAdminDuty] = 0;
SetPlayerName(playerid, PlayerInfo[playerid][pCharName]);
SendClientMessage(playerid, COLOR_GRAD3, "You have successfully left admin duty.");
}
return 1;
}
No errors while compiling.
Re: SetPlayerName Error -
=KempeR= - 27.10.2013
is your sscanf include/plugin up to date?
Re: SetPlayerName Error -
mrtms - 27.10.2013
It's not printing the correct variable for PlayerInfo[playerid][pAdminName], evidently that's blank when I print it in the console.
Re: SetPlayerName Error -
Konstantinos - 27.10.2013
SetPlayerName function crashes the server if the name will be given is NULL.
In your case,
PlayerInfo[playerid][pCharName] is NULL.
Re: SetPlayerName Error -
Hamam - 27.10.2013
This link might help you:
https://sampwiki.blast.hk/wiki/SetPlayerName