/stats crashes (+rep)
#1

When im ingame and do /stats its closes the samp-server.exe here is the code, i checked for incorrect/missing brackets didnt find anything out of the oridaniary.

Код:
public ShowStats(playerid, targetid, check)
{
    new string[128],
	sendername[MAX_PLAYER_NAME],
	bank = GetPVarInt(targetid, "Bank"),
    age = GetPVarInt(targetid, "Age"),
    admin = GetPVarInt(targetid, "Admin"),
    house = GetPVarInt(targetid, "HouseKey"),
    //house2 = GetPVarInt(targetid, "HouseKey2"),
    bizz = GetPVarInt(targetid, "BizzKey"),
    number = GetPVarInt(targetid, "PhoneNum"),
    key1 = GetPVarInt(targetid, "CarKey1"),
    key2 = GetPVarInt(targetid, "CarKey2"),
    key3 = GetPVarInt(targetid, "CarKey3"),
    rank = GetPVarInt(targetid, "Rank"),
	walkie = GetPVarInt(targetid, "WalkieFreq"),
    sex[10],
    faction[128],
    jobtxt[20],
    drank[20],
    fightstyle[20],
    walkstyle[20],
    primary[50],
    secondary[50],
	invgun[50],
	rankname[50],
	Float:shealth,
	Float:sarmour,
	statscolor1,
	statscolor2;

	GetPlayerHealth(targetid,shealth); GetPlayerArmour(targetid,sarmour);

    if(GetPVarInt(targetid, "DonateRank") == 4) statscolor1=0x33AA33AA, statscolor2=0xFFFFFFAA;
    else statscolor1=0x4FA7FF96, statscolor2=0xCCEEFF96;

    switch(GetPVarInt(targetid, "Sex"))
    {
        case 1: sex = "Male";
        case 2: sex = "Female";
    }
    switch(GetPVarInt(targetid, "DonateRank"))
    {
        case 0: drank = "None";
        case 1: drank = "Bronze User";
        case 2: drank = "Silver User";
        case 3: drank = "Gold User";
    }
    switch(GetPVarInt(targetid, "Member"))
    {
        case 0: faction = "None";
        case 1: faction = "San Andreas Shierff's Department";
        case 2: faction = "D.E.A";
        case 3: faction = "Government";
        case 4: faction = "Los Santos Fire Department";
        case 5: faction = "San News";
        case 6: faction = "Radio Los Santos";
        case 7: faction = "Los Santos Police Department";
        case 8 .. SCRIPT_FACTIONS: faction = "Offical Faction";
    }
    switch(GetPVarInt(targetid, "Job"))
    {
        case 0: jobtxt = "None";
        case 1: jobtxt = "Mechanic";
        case 2: jobtxt = "Garbage Man";
        case 3: jobtxt = "Street Sweeper";
        case 4: jobtxt = "Pizza Boy";
        case 5: jobtxt = "Taxi Driver";
        case 6: jobtxt = "Trucker";
        case 7: jobtxt = "Cleaner";
        case 8: jobtxt = "Farmer";
    }
    switch(GetPlayerFightingStyle(targetid))
    {
        case FIGHT_STYLE_NORMAL: fightstyle = "Normal";
        case FIGHT_STYLE_BOXING: fightstyle = "Boxing";
		case FIGHT_STYLE_KUNGFU: fightstyle = "KungFu";
		case FIGHT_STYLE_KNEEHEAD: fightstyle = "KneeHead";
		case FIGHT_STYLE_GRABKICK: fightstyle = "GrabKick";
		case FIGHT_STYLE_ELBOW: fightstyle = "Elbow";
    }
    switch(GetPlayerWalkStyle(targetid))
    {
        case 0: walkstyle = "None";
        case WALKSTYLE_GANG1: walkstyle = "Gang-1";
        case WALKSTYLE_GANG2: walkstyle = "Gang-2";
        case WALKSTYLE_NORMAL: walkstyle = "Normal";
        case WALKSTYLE_SEXY: walkstyle = "Sexy";
        case WALKSTYLE_OLD: walkstyle = "Old";
        case WALKSTYLE_SNEAK: walkstyle = "Sneaking";
        case WALKSTYLE_BLIND: walkstyle = "Blind";
        case WALKSTYLE_ARMED: walkstyle = "Armed";
        case WALKSTYLE_POLICE: walkstyle = "Police";
    }

    if(GetPVarInt(targetid, "Member") >= 8)
    {
        switch(GetPVarInt(targetid, "Rank"))
        {
            case 1: format(rankname, sizeof(rankname),"%s", FactionInfo[GetPVarInt(targetid, "Member")][fRank1]);
            case 2: format(rankname, sizeof(rankname),"%s", FactionInfo[GetPVarInt(targetid, "Member")][fRank2]);
            case 3: format(rankname, sizeof(rankname),"%s", FactionInfo[GetPVarInt(targetid, "Member")][fRank3]);
            case 4: format(rankname, sizeof(rankname),"%s", FactionInfo[GetPVarInt(targetid, "Member")][fRank4]);
		    case 5: format(rankname, sizeof(rankname),"%s", FactionInfo[GetPVarInt(targetid, "Member")][fRank5]);
		    case 6: format(rankname, sizeof(rankname),"%s", FactionInfo[GetPVarInt(targetid, "Member")][fRank6]);
        }
    }

    if(IsPlayerHaveHeavy(targetid)) GetWeaponName(PlayerHeavy(targetid), primary, sizeof(primary));
    else primary = "None";

    if(IsPlayerHaveSidarm(targetid)) GetWeaponName(PlayerSidarm(targetid), secondary, sizeof(secondary));
    else secondary = "None";

    if(GetPVarInt(targetid, "InvWeapon") > 0 && GetPVarInt(targetid, "InvAmmo") > 0) GetWeaponName(GetPVarInt(targetid, "InvWeapon"), invgun, sizeof(invgun));
    else invgun = "None";

	format(sendername, sizeof(sendername), "%s", PlayerName(targetid));
	GiveNameSpace(sendername);
    SendClientMessage(playerid,statscolor1,"|________________________________________%s________________________________________|", sendername);
    format(string, sizeof(string),"| Character | Faction:[%s] Rank:[%s][%d] Married To:[%s] Walkie Freq:[%d] Age:[%d] Sex:[%s] Occupation:[%s] Ph:[%d] ", FactionInfo[GetPVarInt(targetid, "Member")][fName], rankname, rank, PlayerInfo[targetid][pMarriedTo], walkie, age, sex, jobtxt, number, jobtxt);
    SendClientMessage(playerid,statscolor2,string);
    format(string, sizeof(string),"| Weapons | Primary Weapon:[%s] Ammo:[%d] Secondary Weapon:[%d] Fightstyle:[%s] Walkstyle:[%s]", primary, GetPVarInt(targetid, "InvAmmo"), secondary, age, sex, fightstyle, walkstyle);
    SendClientMessage(playerid,statscolor2,string);
    format(string, sizeof(string),"| Level | Hours On:[%d] DonatorLevel:[%s]", GetPVarInt(targetid, "ConnectTime"), drank);
    SendClientMessage(playerid,statscolor2,string);
    format(string, sizeof(string),"| Skill | Health:[%.1f]", shealth);
    SendClientMessage(playerid,statscolor2,string);
    format(string, sizeof(string),"| Money | Cash:[$%s] Bank:[$%d]", GetPlayerMoneyEx(targetid), bank);
    SendClientMessage(playerid,statscolor2,string);
    format(string, sizeof(string),"| Other | N/C:[%d] | Bans:[%d] | Kicks:[%d] | Ajails:[%d]", SetPVarInt(targetid, "Changes"), GetPVarInt(targetid, "Bans"), GetPVarInt(targetid, "Kicks"), GetPVarInt(targetid, "Jails"));
    if(key1 != SCRIPT_CARS)
    {
        format(string, sizeof(string),"(Vehicle 1): Model:[%s] Value:[%d] ColorOne:[%d] ColorTwo:[%d] Locked:[%d] Impound Price:[%d] Insurance:{%d}", VehicleName[CarInfo[key1][cModel]-400], CarInfo[key1][cValue], CarInfo[key1][cColorOne] , CarInfo[key1][cColorTwo], CarInfo[key1][cLock] , CarInfo[key1][cImpoundPrice] , CarInfo[key1][cIns]);
        SendClientMessage(playerid,statscolor2,string);
    }
    if(key2 != SCRIPT_CARS)
    {
        format(string, sizeof(string),"(Vehicle 2): Model:[%s] Value:[%d] ColorOne:[%d] ColorTwo:[%d] Locked:[%d] Impound Price:[%d] Insurance:{%d}", VehicleName[CarInfo[key2][cModel]-400], CarInfo[key2][cValue], CarInfo[key2][cColorOne] , CarInfo[key2][cColorTwo], CarInfo[key2][cLock] , CarInfo[key2][cImpoundPrice] , CarInfo[key2][cIns]);
        SendClientMessage(playerid,statscolor2,string);
    }
    if(key3 != SCRIPT_CARS)
    {
        format(string, sizeof(string),"(Vehicle 3): Model:[%s] Value:[%d] ColorOne:[%d] ColorTwo:[%d] Locked:[%d] Impound Price:[%d] Insurance:{%d}", VehicleName[CarInfo[key3][cModel]-400], CarInfo[key3][cValue], CarInfo[key3][cColorOne] , CarInfo[key3][cColorTwo], CarInfo[key3][cLock] , CarInfo[key3][cImpoundPrice] , CarInfo[key3][cIns]);
        SendClientMessage(playerid,statscolor2,string);
	}
	if(house != 1000)
	{
	    format(string, sizeof(string),"(Property): Owner:[%s] Value:[%d] Locked:[%d] Rentable:[%d]", HouseInfo[house][hOwner],HouseInfo[house][hPrice],HouseInfo[house][hLock],HouseInfo[house][hRentable]);
        SendClientMessage(playerid,statscolor2,string);
	}
	/*if(house2 != 1000)
	{
	    format(string, sizeof(string),"(Second Property): Owner:[%s] Value:[%d] Locked:[%d] Rentable:[%d]", HouseInfo[house][hOwner],HouseInfo[house][hPrice],HouseInfo[house][hLock],HouseInfo[house][hRentable]);
        if(GetPVarInt(playerid, "SpouseKeyOwn") == 1) SendClientMessage(playerid,statscolor2,string);
	}*/
	if(bizz != 1000)
	{
	    format(string, sizeof(string),"(Bizz): Owner:[%s] Value:[%d] Locked:[%d]", BizzInfo[bizz][bOwner],BizzInfo[bizz][bPrice],BizzInfo[bizz][bLock]);
        SendClientMessage(playerid,statscolor2,string);
	}
	if(GetPVarInt(playerid, "Admin") != 0)
    {
		if(GetPVarInt(targetid, "Admin") >= 11) admin=0;
        format(string, sizeof(string),"Admin:[%d] HouseKey:[%d] BizzKey:[%d] Car1:[%d](ID:%d) Car2:[%d](ID:%d) Car3:[%d](ID:%d) Int:[%d] World:[%d]", admin, house, bizz, key1, OwnableVehicleID(key1), key2, OwnableVehicleID(key2), key3, OwnableVehicleID(key3),GetPlayerInterior(targetid),GetPlayerVirtualWorld(targetid));
        SendClientMessage(playerid,statscolor2,string);
	}
    SendClientMessage(playerid,statscolor1,"|________________________________________%s________________________________________|", sendername);
    return 1;
}
Reply
#2

There is no code...
Reply
#3

Quote:
Originally Posted by JasperM
Посмотреть сообщение
There is no code...
I forgot, its updated now.
Reply
#4

What is printing if you use this:
https://sampforum.blast.hk/showthread.php?tid=262796

Can you show us your server.log after you start the server with this plugin and try to open the stats?
Reply
#5

Quote:
Originally Posted by MarvinPWN
Посмотреть сообщение
What is printing if you use this:
https://sampforum.blast.hk/showthread.php?tid=262796

Can you show us your server.log after you start the server with this plugin and try to open the stats?
Код:
[15:20:40] [debug] Server crashed while executing IG-RP.amx
[15:20:40] [debug] AMX backtrace:
[15:20:40] [debug] #0 native SendClientMessage () [004715b0] from samp-server.exe
[15:20:40] [debug] #1 002724e0 in ?? () from IG-RP.amx
[15:20:40] [debug] #2 00153d6c in public cmd_stats () from IG-RP.amx
[15:20:40] [debug] #3 native CallLocalFunction () [00474110] from samp-server.exe
[15:20:40] [debug] #4 0000b030 in public OnPlayerCommandText () from IG-RP.amx
[15:20:41] [debug] Native backtrace:
[15:20:41] [debug] #0 0049c33c in ?? () from C:\Users\Nick\Documents\SAMP S\samp-server.exe
[15:20:41] [debug] Server crashed while executing IG-RP.amx
[15:20:41] [debug] AMX backtrace:
[15:20:41] [debug] #0 native SendClientMessage () [004715b0] from samp-server.exe
[15:20:41] [debug] Server crashed while executing IG-RP.amx
[15:20:41] [debug] AMX backtrace:
[15:20:41] [debug] #0 native SendClientMessage () [004715b0] from samp-server.exe
Reply
#6

PHP код:
SendClientMessage(playerid,statscolor1,"|________________________________________%s________________________________________|"sendername); 
You have to format this.
And at the end of this callback too.
If you don't know what I mean so please contact me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)