06.08.2013, 14:31
I'm having an issue with a command crashing my server, this is the server log;
Quote:
[15:33:29] [debug] Server crashed while executing SFRP.amx [15:33:29] [debug] AMX backtrace: [15:33:29] [debug] #0 00000014 in public @yC_givelicense () from SFRP.amx [15:33:29] [debug] #1 native CallRemoteFunction () [00471ae0] from samp-server.exe [15:33:29] [debug] #2 00024034 in ?? () from SFRP.amx [15:33:29] [debug] #3 00023900 in ?? () from SFRP.amx [15:33:29] [debug] #4 00012cd4 in public OnPlayerCommandText () from SFRP.amx [15:33:29] [debug] System backtrace: |
pawn Код:
YCMD:givelicense(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Give a player a Firearms License (A/B/C).");
return 1;
}
if(!IsAnLEO(playerid) || GetPVarInt(playerid, "Faction") == 1 && GetPVarInt(playerid, "Rank") < 6) {
SendClientMessage(playerid, X11_TOMATO_2, "You are not part of the SASD.");
return 1;
}
if(!IsOnDuty(playerid)) {
SendClientMessage(playerid, X11_TOMATO_2, "You must be on duty to perform this command.");
return 1;
}
if(GetPVarInt(playerid, "Rank") < 6) {
SendClientMessage(playerid, X11_TOMATO_2, "You are not able to use this command.");
return 1;
}
new target, type[32];
new msg[128];
if(!sscanf(params, "k<playerLookup_acc>s[32]", target, type)) {
new ELicenseFlags:lflags = ELicenseFlags:GetPVarInt(playerid, "LicenseFlags");
if(!strcmp(type, "FirearmsA", true)) {
lflags |= ELicense_GunA;
} else if(!strcmp(type, "FirearmsB", true)) {
lflags |= ELicense_GunB;
} else if(!strcmp(type, "FirearmsC", true)) {
lflags |= ELicense_GunC;
} else {
SendClientMessage(playerid, X11_TOMATO_2, "Invalid License type!");
return 1;
}
new fid = GetPVarInt(playerid, "Faction");
format(msg, sizeof(msg), "You have given a %s license to %s.",type,GetPlayerNameEx(target, ENameType_CharName));
SendClientMessage(playerid, COLOR_PGREEN, msg);
format(msg, sizeof(msg), "You have been given a %s license.",type);
SendClientMessage(target, COLOR_PGREEN, msg);
format(msg, sizeof(msg), "%s has been given a Firearms License (A/B/C) by %s.",GetPlayerNameEx(ENameType_RPName_NoMask), GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
SendFactionMessage(fid, COLOR_PGREEN, msg);
SetPVarInt(target, "LicenseFlags", _:lflags);
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /givelicense [playerid/name] [type]");
SendClientMessage(playerid, COLOR_PGREEN, "FirearmsA, FirearmsB, FirearmsC");
}
return 1;
}