Pawno Crashes.
#1

This code is crashing my pawno

Код:
(if(IsPlayerInAnyVehicle(playerid))

	    if(VehicleWindows[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR, "[Windows Open]: %s", text);
		}
		else if(VehicleWindows[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR, "[Windows Shut]: %s", text);
		}
	}
	return 1;
}
Else command works fine..

Help me pease.
Reply
#2

Try:

PHP код:
if(IsPlayerInAnyVehicle(playerid))
{
       new 
str[128];
        if(
VehicleWindows[playerid] == 0)
        {
                
format(strsizeof(str), "[Windows Open]: %s"text);
            
SendClientMessage(playeridCOLORstr);
        }
        else if(
VehicleWindows[playerid] == 1)
        {
                
format(strsizeof(str), "[Window shout]: %s"text);
        
SendClientMessage(playeridCOLORstr);
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by Plovix
Посмотреть сообщение
Try:

PHP код:
if(IsPlayerInAnyVehicle(playerid))
{
new 
str[128];
        if(
VehicleWindows[playerid] == 0)
        {
                
format(strsizeof(str), "[Windows Open]: %s"text);
            
SendClientMessage(playeridCOLORstr);
        }
        else if(
VehicleWindows[playerid] == 1)
        {
                
format(strsizeof(str), "[Window shout]: %s"text);
        
SendClientMessage(playeridCOLORstr);
        }
    }
    return 
1;

Still crashes with this code , Compiles fine when i remove.
Reply
#4

Can you show full command/callback??
Reply
#5

Quote:
Originally Posted by Plovix
Посмотреть сообщение
Can you show full command/callback??
PHP код:
new VehicleWindows[MAX_VEHICLES] = 0
Command
PHP код:
CMD:windows(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            {
            
SendClientMessage(playeridCOLOR_GREY" This vehicle doesnt come with a window.");
            return 
1;
            }
        if(
VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
        {
        
VehicleWindows[GetPlayerVehicleID(playerid)] = 1;
        
format(stringsizeof(string), "* %s rolls down the window."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
          return 
1;
        }
        else if(
VehicleWindows[GetPlayerVehicleID(playerid)] == 1)
        {
        
VehicleWindows[GetPlayerVehicleID(playerid)] = 0;
        
format(stringsizeof(string), "* %s rolls up the window."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        return 
1;
        }
        return 
1;
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"  You need to be in vehicle !");
        return 
1;
        }
    }
    return 
1;

OnPlayerText
PHP код:
public OnPlayerText(playeridtext[])          
 if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
VehicleWindows[playerid] == 0)
        {
            
SendClientMessage(playeridCOLOR"[Windows Open]: %s"text);
        }
        else if(
VehicleWindows[playerid] == 1)
        {
            
SendClientMessage(playeridCOLOR"[Windows Shut]: %s"text);
        }
    }
    return 
1;

There you go ,,
Reply
#6

Try this:

PHP код:
CMD:windows(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
SendClientMessage(playeridCOLOR_GREY" This vehicle doesnt come with a window.");
            return 
1;
        }
        if(
VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
        {
        
VehicleWindows[GetPlayerVehicleID(playerid)] = 1;
        
format(stringsizeof(string), "* %s rolls down the window."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
          return 
1;
        }
        else if(
VehicleWindows[GetPlayerVehicleID(playerid)] == 1)
        {
        
VehicleWindows[GetPlayerVehicleID(playerid)] = 0;
        
format(stringsizeof(string), "* %s rolls up the window."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        return 
1;
        }
        return 
1;
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"  You need to be in vehicle !");
        return 
1;
        }
    }
    return 
1;

PHP код:
public OnPlayerText(playeridtext[])
{          
new 
str[128];
 if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
VehicleWindows[playerid] == 0)
        {
            
format(strsizeof(str), "[Windows Open]: %s"text);
            
SendClientMessage(playeridCOLORstr); 
        }
        else if(
VehicleWindows[playerid] == 1)
        {
            
format(strsizeof(str), "[Windows Shout]: %s"text);
            
SendClientMessage(playeridCOLORstr); 
        }
    }
    return 
1;

Reply
#7

Quote:
Originally Posted by Plovix
Посмотреть сообщение
Try this:

PHP код:
CMD:windows(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
SendClientMessage(playeridCOLOR_GREY" This vehicle doesnt come with a window.");
            return 
1;
        }
        if(
VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
        {
        
VehicleWindows[GetPlayerVehicleID(playerid)] = 1;
        
format(stringsizeof(string), "* %s rolls down the window."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
          return 
1;
        }
        else if(
VehicleWindows[GetPlayerVehicleID(playerid)] == 1)
        {
        
VehicleWindows[GetPlayerVehicleID(playerid)] = 0;
        
format(stringsizeof(string), "* %s rolls up the window."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        return 
1;
        }
        return 
1;
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"  You need to be in vehicle !");
        return 
1;
        }
    }
    return 
1;

PHP код:
public OnPlayerText(playeridtext[])
{          
new 
str[128];
 if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
VehicleWindows[playerid] == 0)
        {
            
format(strsizeof(str), "[Windows Open]: %s"text);
            
SendClientMessage(playeridCOLORstr); 
        }
        else if(
VehicleWindows[playerid] == 1)
        {
            
format(strsizeof(str), "[Windows Shout]: %s"text);
            
SendClientMessage(playeridCOLORstr); 
        }
    }
    return 
1;

Still Crashing
Reply
#8

you had an extra bracket

Try this

pawn Код:
CMD:windows(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, " This vehicle doesnt come with a window.");
            return 1;
        }
        if(VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
        {
            VehicleWindows[GetPlayerVehicleID(playerid)] = 1;
            format(string, sizeof(string), "* %s rolls down the window.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
        else if(VehicleWindows[GetPlayerVehicleID(playerid)] == 1)
        {
            VehicleWindows[GetPlayerVehicleID(playerid)] = 0;
            format(string, sizeof(string), "* %s rolls up the window.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "  You need to be in vehicle !");
        return 1;
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Kreyg
Посмотреть сообщение
you had an extra bracket

Try this

pawn Код:
CMD:windows(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, " This vehicle doesnt come with a window.");
            return 1;
        }
        if(VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
        {
            VehicleWindows[GetPlayerVehicleID(playerid)] = 1;
            format(string, sizeof(string), "* %s rolls down the window.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
        else if(VehicleWindows[GetPlayerVehicleID(playerid)] == 1)
        {
            VehicleWindows[GetPlayerVehicleID(playerid)] = 0;
            format(string, sizeof(string), "* %s rolls up the window.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "  You need to be in vehicle !");
        return 1;
    }
    return 1;
}
Its the OnPlayerText Code which is Crashing pawno, - Command works fine
Reply
#10

pawn Код:
#define FILTERSCRIPT

#include < a_samp >

#define COLOR -1

new
    VehicleWindows[ MAX_PLAYERS ]
;

public OnPlayerText(playerid, text[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new
            string[ 128 ]
        ;
        if(VehicleWindows[playerid] == 0) format(string, sizeof(string), "[Windows Open]: %s", text);
        else if(VehicleWindows[playerid] == 1) format(string, sizeof(string), "[Windows Shut]: %s", text);
        SendClientMessage(playerid, COLOR, string);
    }
    return 1;
}
pawn Код:
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)