I don't know what is happening.
#1

PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
#else
main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}
#endif
enum pInfo
{
    
Developer,
    
Wolf,
     
SFCS,
    
SFCMS,
    
Owner,
    
Admin
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/stats"cmdtexttrue10) == 0)
    {
        new 
str[268];
        new 
str2[269];
        new 
str3[128];
        new 
Float:health;
        new 
Float:Armour;
        new 
race[20];
        new 
howner[20];
        new 
money GetPlayerMoney(playerid);
        new 
score GetPlayerScore(playerid);
        new 
skin GetPlayerSkin(playerid);
        new 
faction[20];
        new 
igadmin[20];
        new 
interiorid GetPlayerInterior(playerid);
        new 
vw GetPlayerVirtualWorld(playerid);
        new 
name GetPlayerName(playeridstrsizeof(str));
        {
         if(
PlayerInfo[playerid][SFCS] == 1)
        {
            
faction "College Security";
        }
        if(
PlayerInfo[playerid][SFCMS] == 1)
        {
            
faction "College Medic";
        }
        else
        {
            
faction "Unemployed";
        }
        }
        {
         if(
PlayerInfo[playerid][Wolf] == 1)
        {
            
race "Werewolf";
        }
        if(
PlayerInfo[playerid][Developer] == 1)
        {
            
race "Vampire";
        }
        else
        {
            
race "Human ";
        }
        }
        {
        if(
PlayerInfo[playerid][Owner] == 1)
        {
            
howner "Yes";
        }
        else
        {
            
howner "No";
        }
        }
        if(
PlayerInfo[playerid][Admin] == 1)
        {
            
igadmin "Yes";
        }
        else
        {
            
igadmin "No";
        }
        
GetPlayerHealth(playerid,health);
        
GetPlayerArmour(playerid,Armour);
        
format(strsizeof(str), "Name: %s | Money: $%d| Health: %.1f | Armour: %.1f | Race: %s"str,name,money,health,Armour,race);
         
format(str2sizeof(str), "SkinID: %d | Level: %d | HouseOwner: %s | Admin: %s | Faction: %s"str2,skin,score,howner,igadmin,faction);
        
format(str3sizeof(str), "InteriorID: %d | VirtualWorld: %i"str3,interiorid,vw);
        
SendClientMessage(playerid,0x33AA33AA,"|___________________________STATS_____________________________|");
        
SendClientMessage(playerid,-1,str);
        
SendClientMessage(playerid,-1,str2);
        
SendClientMessage(playerid,-1,str3);
        
SendClientMessage(playerid,0x33AA33AA,"|_____________________________________________________________|");
        return 
1;
    }
    return 
0;

No errors but they are messing up ig.Like if I have 100 health and no armour it shows armour 100 and health 0.
Reply
#2

This is wrong:
pawn Код:
new name = GetPlayerName(playerid, str, sizeof(str));
Because GetPlayerName returns the length of the string that should be stored.

This should be fine:
pawn Код:
GetPlayerName(playerid, str, sizeof(str));
And this:
pawn Код:
format(str, sizeof(str), "Name: %s | Money: $%d| Health: %.1f | Armour: %.1f | Race: %s", str,name,money,health,Armour,race);
Just remove "name"

Like here:
pawn Код:
format(str, sizeof(str), "Name: %s | Money: $%d| Health: %.1f | Armour: %.1f | Race: %s", str,money,health,Armour,race);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)