SA-MP Forums Archive
Dialog crash help - 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: Dialog crash help (/showthread.php?tid=600077)



Dialog crash help - N0FeaR - 03.02.2016

My server crash when i try to change skin what might be the problem here, is something with the ispoliceskin.

PHP код:
stock IsPoliceskin(skinplayerid)
{
    if(
IsACop(playerid))
    if(!(
280 <= skin <= 288)) return 1;
    return 
0;

PHP код:
case G_LOCKER_UNIFORM: if(response)    {
            new 
skin strval(inputtext), iGroupID PlayerInfo[playerid][pMember];
    
this line make the crash        if(IsPoliceskin(skin)) return SendClientMessageEx(playeridCOLOR_LIGHTRED"[SERVER]: You're not in LSPD so you cannot use that skin"); 
            if(
IsInvalidSkin(skin)) {
                return 
ShowPlayerDialog(playeridG_LOCKER_UNIFORMDIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.""Select""Cancel");
            }
            
PlayerInfo[playerid][pModel] = skin;
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]); 



Re: Dialog crash help - BiosMarcel - 03.02.2016

if(IsPoliceskin(skin,playerid))


Re: Dialog crash help - N0FeaR - 03.02.2016

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
if(IsPoliceskin(skin,playerid))
That wont change anything.


Re: Dialog crash help - valych - 03.02.2016

Maybe the problem is in SendClientMessageEx function?


Re: Dialog crash help - BiosMarcel - 03.02.2016

Well its a miracle that u were able to compile anyways since u just ignored one of the parameters
And also u should think bout your coding style, use brackets ...
Its not just the missing brackets tho ^^


Re: Dialog crash help - N0FeaR - 03.02.2016

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
Well its a miracle that u were able to compile anyways since u just ignored one of the parameters
And also u should think bout your coding style, use brackets ...
Its not just the missing brackets tho ^^
Still i don't understand whats the problem


Re: Dialog crash help - Mencent - 03.02.2016

Try this:
PHP код:
stock IsPoliceskin(skinplayerid)
{
    if(
IsACop(playerid))
    {
        if(!(
280 <= skin <= 288)) return 1;
    }
    return 
0;
}
case 
G_LOCKER_UNIFORM:
{
    if(
response)
    {
        new 
skin strval(inputtext),iGroupID PlayerInfo[playerid][pMember];
        if(
IsPoliceskin(skin,playerid))return SendClientMessageEx(playeridCOLOR_LIGHTRED"[SERVER]: You're not in LSPD so you cannot use that skin");
        if(
IsInvalidSkin(skin))
        {
            return 
ShowPlayerDialog(playeridG_LOCKER_UNIFORMDIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.""Select""Cancel");
        }
        
PlayerInfo[playerid][pModel] = skin;
        
SetPlayerSKin(playerid,PlayerInfo[playerid][pModel]);
    }




Re: Dialog crash help - BiosMarcel - 03.02.2016

PHP код:
stock IsPoliceskin(playeridskinId)
{
    if(
IsACop(playerid))
    {
        if(!( (
280 <= skinId) & (skinId <= 288) )) 
        {
            return 
1;
        }
    }
    return 
0;
}  
case 
G_LOCKER_UNIFORM: if(response)    {
    new 
skin strval(inputtext);
    new 
iGroupID PlayerInfo[playerid][pMember];
    
//Like someone mentioned already it may be SendClientMessageEx
    
if(IsPoliceskin(playeridskin))
    {
        return 
SendClientMessageEx(playeridCOLOR_LIGHTRED"[SERVER]: You're not in LSPD so you cannot use that skin"); 
    }            
    if(
IsInvalidSkin(skin)) 
    {
        return 
ShowPlayerDialog(playeridG_LOCKER_UNIFORMDIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.""Select""Cancel");
    }
    
PlayerInfo[playerid][pModel] = skin;
    
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]);  
//}?

If u write your code like that you can overlook it easier